Your application must contain a reference to a component's Object Library
before it can use the component's object classes.
An Object Library is a collection of information about an application's
objects. You can find this information in a .TLB (Type Library) file, an .OLB (Object Library)
file, or in an ActiveX server's EXE or DLL file.
To locate the COM component's Object Library, check the component application's
documentation to see where it stores its Object Library.
However if the component in which you're interested has been properly registered
in the Windows Registry, you won't ever need to know the name or location of the Object
Library. Instead, the Windows Registry will contain information about the component in which
you're interested. In that case, all you need to do is refer to the Windows Registry
entries for the component, as in the following description.
In order to make a COM component's object model available to your application,
you should execute the following steps:
STEP BY STEP
10.1 Making a COM Component's Object Model Available to Your Application
-
Choose Project, References from the main VB menu.
-
Scroll through the Available References list until you find the name of the
COM component that you want (see Figure 10.1). The Object Library list you see
here is not a VB-specific feature, but is generated from the Windows Registry.
FIGURE 10.1 Use the References dialog box to set a reference in your project
to a COM component.
-
Click on Browse to find and select the TLB, OLB, EXE, OCX, or DLL file containing
the server's Object Library if the server you need isn't in the list (see Figure
10.2).
FIGURE 10.2 You can browse for the file containing a component's Object Library
if the component isn't listed in the Available References list of the References
dialog box
-
Select the desired COM component by clicking on the check box to the left of
the server name.
-
Click on OK in the References dialog box.