Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Custom property, methods in VB????
Message
 
To
01/02/2000 08:15:52
Christian Bellavance
Université du Québec à Hull
Hull, Quebec, Canada
General information
Forum:
Visual Basic
Category:
Other
Miscellaneous
Thread ID:
00325073
Message ID:
00325599
Views:
35
The closest VB comes to accomplishing the inheritance you are seeking is with the Implements keyword. Like Christian said, you can create a template form, save it in a known location, and make a copy of it each time you want to use that form.

However, if you only need to implement the same properties and methods in each new instance of your form, create a class with the definitions of the properties and methods (lets call it CTemplate), then type "Implements CTemplate" on a line by itself at the top of your new form's code.

After you insert the "Implements" keyword, "CTemplate" will appear in the objects drop-down list of your form's code window. Likewise, selecting "CTemplate" in the object list will populate the property/method drop-down list with the names of all properties and methods defined in the CTemplate class module.

Take note, though, that you can only create a "shell" for the properties and methods in your template class. It is not a "base class" in the same sense as it would be in VFP and C++ - you can't inherit code from it. (It is, however, somewhat polymorphic in that you can define properties/methods in the template "as Object," but I won't go into that right now.)

Another thing to point out: a form, albeit a special type of class module, cannot be used as a base class for another form. In other words, you can't say "Implements Form1" in the code for Form2.

Hope this helps.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform