How to Test Compiled Components

When you choose Make from the File menu, your component will be registered automatically in the Windows Registry. You can switch your test application between the component project and the compiled component using the procedures in this topic.

In-Process Components

The following procedures perform the switch for an in-process component (ActiveX DLL project or ActiveX control project).

To switch from an in-process component project to the compiled .dll or .ocx file

  1. On the File menu, click Make <projectname> to create the compiled in-process component.

  2. In the Project window, select the component project.

  3. On the File menu, click Remove <projectname> to remove the component project from the project group.

    A warning message will appear: "The project is referenced from another project. Are you sure you want to remove it?" Click OK to remove the project.

  4. Press F5 to run the test project.

    Visual Basic automatically switches references to the compiled .ocx or .dll file.

To switch back to testing your in-process component project

  1. On the File menu, click Add Project to open the Add Project dialog box.

  2. Use the Recent or Existing tab to open your component project.

  3. Press F5 to run the test project.

    Visual Basic automatically switches references back to the component project.

Out-of-Process Components

Remember that an out-of-process component must be tested using two instances of the development environment. The following procedures perform the switch for an out-of-process component (ActiveX Exe project).

To switch from an out-of-process component project to the compiled executable

  1. On the File menu of the component project, click Make <projectname> to create an up-to-date version of the executable.

    Important   If you neglect to make the executable, you’ll get the following error message when you attempt to run your test project: "Connection to type library or object library for remote process has been lost. Press OK for dialog to remove reference."

  2. In the test project, press F5 to run the project.

    When the component project is not running, Visual Basic automatically switches registry entries to point to the compiled executable.

To switch back to testing your out-of-process component project

  1. In the component project, press Ctrl+F5 to run the project.

  2. In the test project, press F5 to run the project.

    When the component project is running, Visual Basic automatically switches registry entries back to it.

You may also want to create an executable file from your test application, and run several instances of it to test your component with multiple client applications.

Testing Your Component with Other Applications

You can test your component from any application that can make Automation calls. For example, you can open a Microsoft Excel module, add a reference to your component by choosing References from the Project menu, and write procedures to create and use objects provided by your component.

Even if you do not expect your component to be used as an extension of end user software tools like Microsoft Excel and Microsoft Access, it’s a good idea to test it with such tools. The more programming tools your component works with, the more value it will have for your company or for your customers.

For More Information   See "Testing and Debugging ActiveX Components" for a list of topics related to testing and debugging.