Manage Code Libraries and Objects with Visual Component Manager

A boon for development teams, Visual Component Manager lets you easily store and reuse components.

Ken Spencer

April 30, 1999

9 Min Read
ITPro Today logo

Make life easy for your development team

Visual Component Manager, which Visual Studio 6 introduced, provides an easy, effective way for developers to manage the code and objects they use every day, a task that has plagued them for years. Visual Component Manager sits on top of the Microsoft Repository and provides an interface for storing and accessing repository items.

Visual Component Manager is available from each Visual Studio tool, but you'll find it in different places, depending on which tool you're using. For example, in Visual Basic (VB), Visual Component Manager is an Add-In on the View menu. Table 1 shows how to access Visual Component Manager from various tools.

Visual Component Manager uses a Microsoft Access or SQL Server database to store the repository and items stored in it. The first time you start Visual Component Manager, it uses an Access database on its installed system to create a local repository. This repository is local to that machine and not designed for sharing, but you can add repositories as local databases or use SQL Server as a network database available to others.

Visual Component Manager is most useful in team environments, but to use it in this way, you must use SQL Server to house the repository. Creating a special database to house the repository is the best way to do so. Open the SQL Server Enterprise Manager, and create the database first. (I named the example repository RepositoryVCM.) Visual Component Manager will add new tables when you create the new repository. Of course, you can store more than one repository in one SQL Server installation, but each repository will use its own database. This approach makes choosing database names challenging, so think about the naming process before you start.

Getting Started

Visual Component Manager installs automatically when you install Visual Studio or one of its applications, such as VB. To use Visual Component Manager with VB, you must start VB. If the New Project dialog box appears, skip it. Otherwise, from the Add-Ins menu, select Add-In Manager and scroll down until you see Visual Component Manager. Check the Loaded/Unloaded and Load on Startup boxes as you see in Screen 1, and click OK to close the Add-In Manager. When you finish these steps, you'll see Visual Component Manager at the bottom of the View menu and the VB toolbar.

To start Visual Component Manager in various Visual Studio tools, use the appropriate technique you find in Table 1. When you start Visual Component Manager, it will display the standard interface you see in Screen 2, page 35, with one repository (named Local Database) in the left pane. The local system creates the repository automatically.

Now, let's create a new repository and store it in SQL Server. Start Visual Component Manager, and right-click the Visual Component Manager entry in the left pane. Select Repository and New from the context menu. Click the SQL Server radio button on the next dialog box, and click OK. Next, select or create a data source by pointing to the database you'll use for the repository.

That's it. After you select the data source, Visual Component Manager talks to SQL Server to create the repository's database structure. This process usually takes several minutes, so read your email or get a cup of coffee. When this creation is finished, you see the new repository in the Visual Component Manager interface as a separate folder in the VCM folder.

Visual Component Manager's folder storage hierarchy is similar to the Windows Explorer folder system. This interface provides easy repository navigation and a simple way to use, store, and work with items.

Visual Component Manager can store many item types in the repository. Table 2 lists the file types that Visual Component Manager directly supports and their extensions. When you add files, Visual Component Manager uses the extension to determine file type.

Table 2's last entry is a catch-all category because Visual Component Manager lets you store anything in the repository (documents, graphics, application files, etc.), making the repository a general-purpose storage facility for projects and supporting documentation. If you combine Visual Component Manager with Visual SourceSafe, you have a complete project tracking, management, and source code control system. The only thing missing is a project resource management tool such as Microsoft Project or Micro-soft Excel. Of course, you can use those tools to manage resources and still use Visual Component Manager to manage the project's documents and other components.

Using Visual Component Manager

Now that you've created a repository, you can enjoy Visual Component Manager's simplicity for working with files such as those listed in Table 2. Let's walk through some repository uses. First, you must add files to the repository. This process, called Publishing, adds a file and information about it to the repository and provides one- stop access to those files and information. To publish a file to the repository, open Visual Component Manager and the folder you want to add files to. Then, using Windows Ex-plorer, select the file or files to add.

Next, drag the files and drop them into the Visual Component Manager folder. Then, click Next on the first step of the Wizard, and fill in the component properties on the Title and Properties step. You'll use these properties when you search for items and view them in Visual Com-ponent Manager. Then, enter the information carefully so that it's useful later. Screen 3 shows this step for the ESell component. Visual Component Manager picks up the items in the top of the dialog from the component. When you complete the entries, click Next.

Next, enter the file's description and keywords. First, enter the description, which can be multiple lines. Next, add keywords, either predefined or your own. Screen 4 shows the keywords for this sample component. Notice that I added ESell and Shopper to the list. Add keywords by clicking the + symbol on the More Properties dialog. When you're finished with the description and keywords, click Next.

Now, select other files to publish with this file. This dialog lets you add other files to the ones you dropped. Click Next when you finish adding files. Next, the COM Registra-tion step lets you check components that you need to register via COM. Be sure to check all COM components on this dialog. These settings add components to the system from the repository. If the item is flagged here and thus needs registration, Visual Component Manager will register it automatically. Finally, click Finish to complete the publishing process. Your files are now ready to use.

You can add or change the database's folder structure. Because Visual Component Manager displays the repository just like Windows Explorer, you can use standard context menus to work with the folders.

To add a folder, right-click the folder that will be the new folder's parent and select Folder and New from the context menu. Name the new folder, and press Enter. To cut, copy, and delete folders, right-click the folder and select one of these options. I'll review similar file operations below.

Accessing Files

Let's turn our attention to accessing files with Visual Component Manager. You're most likely to first use the repository as a common file storage mechanism. Doing so gives your team one place to look for files such as VB source files or COM components. Storing components in one place, such as the repository, helps development teams reuse components and code and eliminate multiple file copies.

To find files in the repository, you can use Visual Component Manager by opening the database to browse for a file, or click the Find Items icon on the toolbar to open the dialog box that you see in Screen 5. Next, select the appropriate search options, and click the Find Now button.

When you find the items, right-click a file, and with one click, open the folder that contains the item. You can add the file to a VB project, save the file to disk, or open the file's properties. Screen 5 shows the Find Items dialog with the options set to search for a file that's part of the ESell application and contains the ESell keyword.

You can use the History tab of Find Items to search for files by their history of actions. For example, you can search for files that have been published or updated within a certain time or by a particular author. Or, you can search for items that have been used.

Use the Related Files dialog box to search for file-related components (i.e., files related by name and type). You can find components and related files easily with this dialog.

The items you store in the repository contain extensive information. For example, when you add a COM component, Visual Component Manager interrogates the component and extracts its interface and other properties, allowing you to view the interface when you select the component.

You can display component properties in the lower window by selecting the component. You can view file details by right-clicking the file and selecting Browse Item Details, if the item is a component. The interface will appear in the lower window.

To add a file to the open project in VB or another tool, right-click the file and select Add to Project, which will add the file to the project as if you had used the Visual Studio tool. If you select a component and Add to Project, Visual Component Manager will ask you where to store the file, then add a reference to your project.

Also, you can copy files or move files from one folder to another. Right-click the file, select Copy from the context menu, and select the folder to copy or move the file to. Then right-click in the folder, and select Paste. If you're copying a file, you can select Paste Shortcut to paste a link to the original file. Also, you can move files by dragging them to a new location, or you can move or copy a file by right-clicking it, dragging it, and releasing it. The context menu will appear, allowing you to move or copy a shortcut.

Long-Awaited Benefits

Visual Component Manager makes component storage and reuse easy. This tool provides real benefits for development teams that need to share and reuse code and components. In fact, Visual Component Manager includes many features that I've wanted since Component Manager first appeared in VB 4.0. I especially like working with SQL Server or Access databases for the repository, but using SQL Server for the repository is the best way to implement this feature in your team environment.

Read more about:

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like