Synchronizing the Class View

Synchronizing the Class View

Now that we have both classes defined, let's examine the class hierarchy to be sure that everything is as we expect it to be. Visual Basic .NET has a handy tool that allows you to view a class hierarchically. Go to the code window in the IDE, right-click, and then select Synchronize Class View. This command displays the Class View window. At the top level is the assembly name Employee. Within the assembly is the namespace CompanyDivision designated by a pair of curly brackets ({}). Inside the namespace is our child class, Division, and within Division is the Bases And Interfaces group, which contains a representation of our Employee class we inherited from.

The constructors, methods, and properties of the Employee class are also displayed, as you can see in Figure 3-11. Next the private member variables of Employee are shown with a lock icon. After the private member variables of Employee are the methods, properties, and private data members of the Division class. Below that is the namespace employees that, if expanded, shows the items in the Employee class.

Figure 3-11

The Class View window allows you to view a class hierarchically.

Another helpful tool is the Object Browser. The Object Browser leads you to just about anything you might want to know about a class. To display the Object Browser, select View|Other Windows|Object Browser, or simply press F2. On the left are the objects available. Our employees namespace is also listed. On the right, the members of the Division class are displayed. Clicking one of the items shows its signature in the bottom panel. At the bottom of Figure 3-12, you can see that Division inherits Employee.employees.Employee.

Figure 3-12

The Object Browser displays the classes available in projects and libraries.

tip

I remember when Microsoft Internet Explorer version 4 came out. I wanted to program its object model (its hierarchy of classes) using Visual Basic. Unfortunately, the documentation about how to do this was as scarce as hen's teeth. By using the Object Browser in classic Visual Basic I could see which methods were available, and I was able to access the Internet Explorer. I strongly suggest that you use the Object Browser to poke around and look at the assemblies listed to get a sense of what's prebuilt and available for you to use in Visual Basic .NET.



Coding Techniques for Microsoft Visual Basic. NET
Coding Techniques for Microsoft Visual Basic .NET
ISBN: 0735612544
EAN: 2147483647
Year: 2002
Pages: 123
Authors: John Connell

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net