Microsoft KB Archive/161008

= How To Add an About Box to an ActiveX Control (UserControl) =

Article ID: 161008

Article Last Modified on 6/29/2004

-

APPLIES TO


 * Microsoft Visual Basic 6.0 Learning Edition
 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition
 * Microsoft Visual Basic 5.0 Control Creation Edition
 * Microsoft Visual Basic 5.0 Professional Edition
 * Microsoft Visual Basic 5.0 Enterprise Edition

-



This article was previously published under Q161008



SUMMARY
An ActiveX control typically exposes an About property to allow developers to see extra information concerning the author of the control. Microsoft Visual Basic allows the creation of this About property for ActiveX controls (UserControls).



Step-by-Step Example
 Open your ActiveX Control project or start a new ActiveX Control project. In the Project window, right-click your ActiveX control (UserControl) object. Click Add, and then click Form. In the Professional and Enterprise Editions, double-click "About Dialog" in the list of form templates. In the Control Creation Edition, there is no "About Dialog" form template. Use the following steps instead:

 Double-click "Form" in the list of form templates. Change the Name of the form to "frmAbout" and the Caption to "About MyApp," where MyApp is the name of your application. Add a CommandButton control to the form and change its Caption to "OK" and its Default property to "True".  Add the following code to the CommandButton control's Click event procedure: Private Sub Command1_Click Unload Me     End Sub </li> Add other controls to the form to give it the appearance you desire. Label controls with the application's title, version, description, and disclaimers are common, as is a PictureBox control for displaying the application's icon and a CommandButton control for displaying "System Information."</li></ol> </li>  In the Project window, right-click your ActiveX control (UserControl) object. Click View Code and add the following code to your ActiveX control (UserControl): Sub ShowAboutBox frmAbout.Show vbModal Unload frmAbout Set frmAbout = Nothing End Sub </li> From the Tools menu, click Procedure Attributes.</li> Select the ShowAboutBox procedure in the Name field, and then click "Advanced>>."</li> Select AboutBox from the Procedure ID field and click OK.</li> Close all of the windows for the ActiveX control (UserControl) project. This will put the control in run mode.</li> Add a "Standard EXE" project (using Add Project in the File menu) and place the ActiveX control (UserControl) on the form. The About property is shown in the control's property list. If you click on the ellipses for this property, the frmAbout dialog box appears.</li></ol>

Additional query words: AboutBox kbControl kbVBp500 kbVBp600 kbVBp kbdsd kbDSupport kb ActiveX

Keywords: kbhowto KB161008

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.