Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Correct ThisForm.Objectname.Property syntax ?
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00142404
Message ID:
00142409
Views:
25
>VFP 5.0a
>
>Hello, I'm a novice at VFP 5.0a app development so please bear with me. Thanks in advance for your help.
>
>I'm trying to enable/disable a group of several form objects.
>They are named in a similar fashion: txtAuxname1, txtAuxname2, etc.
>I've tried to run a quick FOR,ENDFOR to enable them
>
>FOR x = 1 TO 17
>   ThisForm.txtAuxname[x].Enabled = .T.
>ENDFOR
>
>
>But I keep getting an error "TXTAUXNAME" not found. Why is it not adding the value of [x] on the end and using the intended object name?
>
>I've had to resort to building the command and using macro substitution to run it to get the intended results:
>
>
>FOR x = 1 TO 17
>   cCommand="ThisForm.txtAuxname"+ALLTRIM(STR(x))+".Enabled"+"=.T."
>   &cCommand
>ENDFOR
>
>FOR x = 1 TO 17	
>   cCommand="ThisForm.cboAuxname"+ALLTRIM(STR(x))+".Enabled"+"=.T."
>   &cCommand
>ENDFOR
>
>
>This is probably a bad way of doing it, but I couldn't think of anything else. I need to refer to the object with the use of txtAuxname[x] in other parts of my app, but would like to do it the proper way.
>
>
>Thanks again for your help,
>- Brian

Take a Look at SetAll in help.

HTH
Jeff

It's Time to get a gun.

That's what I've been thinkin.

I think I can afford one, If I do a little less Drinkin.

www.TrueGeeks.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform