Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Correct ThisForm.Objectname.Property syntax ?
Message
From
30/09/1998 11:10:20
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Correct ThisForm.Objectname.Property syntax ?
Miscellaneous
Thread ID:
00142404
Message ID:
00142404
Views:
52
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


VFP6 SP5, VFP8 SP1, VFP 9 SP 1 and Win XP SP 3 (unless otherwise specified)


www.wulfsden.com
Next
Reply
Map
View

Click here to load this message in the networking platform