Microsoft KB Archive/189740

= BUG: Class Builder Does Not Handle Base Classes Properly =

Article ID: 189740

Article Last Modified on 5/13/2003

-

APPLIES TO


 * Microsoft Visual Basic 5.0 Learning Edition
 * Microsoft Visual Basic 6.0 Learning Edition
 * Microsoft Visual Basic 5.0 Professional Edition
 * Microsoft Visual Basic 6.0 Professional Edition
 * Microsoft Visual Basic 5.0 Enterprise Edition
 * Microsoft Visual Basic 6.0 Enterprise Edition

-



This article was previously published under Q189740



SYMPTOMS
The Class Builder Utility incorrectly displays derived classes and base class properties.



RESOLUTION
Before creating a derived class, select the appropriate base class in the Class pane. In the Class Module Builder dialog, select the base class in the Based On list and check the box for "This Class is a Top Level Object."

Alternatively, create the derived class directly with code, without using the class builder utility.



STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available.



Steps to Reproduce Behavior
 Add the following classes using the Class Builder Utility:

 Add a class called Person; with two properties Age and FirstName. Add a class called Employee based on Person. Add a class called Customer based on Person.

At this point you will find that Customer is actually subordinate to Employee instead of Person; this would seem to be wrong because we indicated that Customer was supposed to be based on Person. Instead, Customer was based on the Employee class because that was the selected class in the Classes pane. Delete the Customer class.</li> Select the Person class in the Classes pane.</li> Add a class called Customer based on Person.

This creates a perceived hierarchy of classes in the Class pane, but Employee and Customer were created as components of Person, rather than derivatives. Examine the properties of each class to see that Person has both Customer and Employee as additional properties. Customer has Employee as a property and Employee has no properties.</li></ol>

To workaround this problem, do the following:


 * 1) Delete the Employee and Customer classes.
 * 2) Select the Person class and create a new class. Choose Person in the Based On list and check the box for "This Class is a Top Level Object."

When this new class is created, view its properties and note that it has the same properties as Person. Also note that the new class is at the same "level" in the Class pane as the Base class. This is correct; a derived class is not a subordinate or child of the base class.

<div class="references_section">