Working with ActiveX Controls

An ActiveX control, like an intrinsic control, is an object that you place on a form to enable or enhance a user's interaction with an application. ActiveX controls have events and can be incorporated into other controls. In addition, each ActiveX control supplies constants with predefined values, making the management of the control easier.

The visibility of an ActiveX control determines how you add the control to your project. If the control is visible, you must add it to the Toolbox and put it on a form.

    To add an ActiveX control to the Toolbox

  1. On the Project menu, choose Components to display the Components dialog box. You also can display the dialog box by right-clicking on the Toolbox.

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

  2. Select the check box to the left of the control name.
  3. Choose OK to close the Components dialog box. The ActiveX control appears in the Toolbox.

The following screen shot shows the Windows CE-specific controls on the Toolbox.

For invisible controls added at run time, you can add a reference to the control in the References dialog box.

    To add a reference to a control

  1. Select References from the Visual Basic studio Project menu.
  2. Select a control type from the References dialog box and then select OK.
  3. Use the CreateObject function to create an object that cannot receive events or use the CreateObjectWithEvents function to create an object that can receive events. These functions create invisible ActiveX controls only; they cannot create graphical ActiveX controls.

Once you have added an ActiveX control to a project by using either the Components dialog box or the References dialog box, the toolkit automatically downloads the control with the run-time files when you run your application. A control must be downloaded before it can be used.

The following table shows the ActiveX controls included in the toolkit.

Comm Control Finance Control PictureBox Control
CommandBar Control Grid Control TabStrip Control
CommonDialog Control Image Control TreeView Control
File Control ImageList Control Winsock Control
FileSystem Control ListView Control