Partager via


Visual Basic Concepts

Loading ActiveX Controls

ActiveX controls have the file name extension .ocx. You can use the ActiveX controls provided with Visual Basic or obtain additional controls from third-party developers.

You can use ActiveX controls and other insertable objects to your project by adding them to the Toolbox.

Note   Visual Basic ActiveX controls are 32-bit controls. Some third-party developers offer ActiveX controls which are 16-bit controls, and these can no longer be used in Visual Basic.

To add a control to a project's Toolbox

  1. On the Project menu, click Components to display the Components dialog box, as seen in figure 1.1.

    Tip   You can also display the dialog box by right-clicking on the Toolbox.

  2. Items listed in this dialog box include all registered insertable objects, designers, and ActiveX controls.

  3. To add an ActiveX control to the Toolbox, select the check box to the left of the control name.

  4. Click OK to close the Components dialog box. All of the ActiveX controls that you selected will now appear in the Toolbox.

Figure 1.1   The Components dialog box

To add ActiveX controls to the Components****dialog box, click the Browse button, and locate files with the .ocx file name extension. These files are commonly installed in your \Windows\System or System32 directory. When you add an ActiveX control to the list of available controls, Visual Basic automatically selects its check box in the Components dialog box.