The testing method discussed in the previous section is fine if you want to see
how your control behaves in an existing application. However, you will also want to see how your control
behaves when other programmers use it in their own VB projects. In order to test your ActiveX
control in the VB design environment, you need to use a test project in the same Project Group
as your ActiveX control.
To test your control with another VB project, you should take the following steps:
STEP BY STEP
13.8 Testing Your ActiveX Control with Another VB Project
-
Choose the File, Add Project menu option and add a standard EXE project to
your Project Group.
-
Make sure that the new project is the Startup project of the Project Group
by right-clicking on the project's entry in the Project explorer and choosing
Set as Startup from the menu (see Figure 13.15).
FIGURE 13.15 Add a standard EXE project to test your custom control and make
sure it's the Startup project of the Project Group.
-
Make sure to close the Designer window for your UserControl object. If you
forget to close its Designer, the custom control won't be available in your test
project. You'll be able to see it in the test project, but its toolbox image and
any instances you've already placed on test forms will be disabled, as illustrated
in Figure 13.16).
FIGURE 13.16 This custom control's design-time instance is disabled in the
test project because the developer hasn't closed the Designer window for the control
itself
-
Switch to the test project, and you will see the UserControl's ToolBoxBitmap
or default ActiveX control bitmap in the toolbox (see Figure 13.17).
FIGURE 13.17 This toolbox contains the default ActiveX control bitmap for
a custom control that is being tested.
-
Place an instance of your control from the toolbox on the test project's startup
form. Write code and manipulate properties to exercise your control.
-
Run the test project to observe the control's behavior.