You can also use objects from other applications, such as those included in the Microsoft Excel object library, either as controls in the toolbox or as programmable objects in your code. To add objects to the toolbox, see "Adding Controls to a Project" earlier in this chapter.
To make another application's objects available in your code, but not as controls, set a reference to that application's object library.
To add a reference to another application's object library
Ø From the Project menu, choose References.
Ø The References dialog box is displayed, as shown in Figure 10.3.
Ø Select the check box next to each reference you want to add to your project.
Ø To add references to applications not listed in the References dialog box, choose the Browse button, and then select the application.
Ø Choose OK to add the selected references to your project.
If you are not using any objects in a referenced library, you should clear the check box for that reference to minimize the number of object references Visual Basic must resolve, thus reducing the time it takes your project to compile.
Once you have set references to the object libraries you want, you can find a specific object and its methods and properties in the Object Browser by choosing Object Browser from the View menu. You can use any object listed in the Object Browser in your code.
Using a Resource File
A resource file allows you to collect all of the version-specific text and bitmaps for an application in one place. This can include constant declarations, icons, screen text, and other material that may change between localized versions or between revisions or specific configurations.
To add a file to a project
Ø From the Project menu, select Add File.
Ø The Add File dialog box is displayed.
Ø Select an existing resource file (.res) and choose Open.
No comments:
Post a Comment