Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to create custom method / property in VB?
Message
 
To
06/09/2000 09:45:42
Marlou Gargantos
Independent Consultant
Manila, Philippines
General information
Forum:
Visual Basic
Category:
Other
Miscellaneous
Thread ID:
00412732
Message ID:
00412971
Views:
23
>Property in VFP can also be created programmatically. How do you create a property in VB form? How do you call it? Is it Me.myProperty = something?

You setup a property by simply declaring a variable in the declaration section of the form. If you use Public (eg: Public MyProperty As String) then you can access it from outside the form (eg: Form1.MyProperty = "Hello World"). You can also wrap it in a Property Procedure pair, it gives you somewhat of the functionality of VFP's _Assign and _Access. (check VB help). Within the form you refer to it like any other variable.

>BTW, when outside the form that has the method or property, how do you call the method if it is really attached to the form?

Same as in VFP. If it is public then Form1.MyMethod. If you want it to return a value like Value = Form1.MyMethod(parm1) then you need to declare it as a Function rather than Sub.
George
Previous
Reply
Map
View

Click here to load this message in the networking platform