Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Mandatory field, not xxxx
Message
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01342883
Message ID:
01342930
Views:
6
Hi Moises,

Suppose, we want to change text1 value to 'bbbbbb' and the textbox name 'text1' is in a variable TextBoxToChange.

Here is how we do it without macro

store 'bbbbbb' to ('thisform.' + TextBoxToChange + ".value") && this is the simplest way if we only need to assign something

We're using name expression here.

We can also do it this way:
loTextBox = evaluate('thisform.' + TextBoxToChange) && alternatively can use GetPem here, but I don't have VFP help handy to check the syntax

loTextBox.value = 'bbbbbb'
loTextBox.RunSomeMethod()
There is almost no need for any macros to do object manipulations.

>Naomi
>
>I kept the & because I need a variable to be a member of a form
>
>
>thisform.text1.value= "aaaa"
>
>store "text2" to my myText
>
>thisform.&mytext.value = "aaaa" && does not work
>
>then:
>
>store "thisform." + Mytext + ".value" to txtBox
>
>&txtBox = "aaaa" && now works
>
>
>How would you remove the & from it ?

store 'aaaaa' to ('thisform.' + myText + ".value")
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform