Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Several Questions
Message
From
29/11/2001 12:41:39
 
 
To
26/11/2001 04:57:44
Jimi Lee
Pop Electronic Products Ltd.
Hong Kong, Hong Kong
General information
Forum:
Visual Basic
Category:
Other
Miscellaneous
Thread ID:
00585052
Message ID:
00587565
Views:
25
>Hi Philip,
>
>Thanks very much for your reply, but I dont understand what is "In a sub for the form that contains the control".. would you please guild me in more detail?
>
>Jimi
>

Hi Jimi,

Sorry for the late reply. I missed your post...

By "sub on the form" I mean from within any code on the form. For example, in VFP, say you had a form that had a textbox called txtText and a button called cmdButton. To reference the value of the textbox in the button's code, you'd have to do something like:

THIS.Parent.txtText.Value

or perhaps

THISFORM.txtText.Value

In VB, it is different. Every object has to have a unique name, and VB enforces this. For example, you cannot have 2 textboxes on the same form, both called txtText, unless it is a control array, in which case you'd use txtText(0) for one, and txtText(1) for the other. The individual object names are still unique.

To reference the textbox value from the button on the VB form, or from anywhere else in the VB form code for that matter, you'd simply use:

txtText.Text

You do not use full object hierarchy (THIS.Parent.. etc.)

HTH,
Phil
_____________________________
Phil Miles
http://www.philmiles.com
phil@philmiles.com
Previous
Reply
Map
View

Click here to load this message in the networking platform