Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Building object name and calling it
Message
From
04/03/2017 02:18:11
 
 
To
03/03/2017 23:30:33
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Database:
Visual FoxPro
Application:
Desktop
Miscellaneous
Thread ID:
01648762
Message ID:
01648766
Views:
46
Likes (1)
Some of the formulas used can be simplified quite a bit.

ALLTRIM(STR(x)) can be replaced by Transform(x)

PadL(ALLTRIM(STR(x)), 7,'0') (you reversed the parameters) can be replaced by Padl(x,7,'0')

>Store .t. to ("thisform." + thisobject +".visible")
>
>is the cleanest and also fastest way to set with a variable.
>
>thisform.&thisobject..visible=.t.
>
>should work as well, but IMO should be avoided (note the 2! dots before visible)
>
>For the ***specific*** loop line best (cleanest,fastest, most succinct):
>
>Store .t. to ("thisform.Dayjobsline" + ALLTRIM(STR(x)) +".visible")
>
>Personal preference for logging/errormsg/debug would be always same length of numberstring, so I'd add PadL(ALLTRIM(STR(x)), "0", 7) to Dayjobsline, but that clearly is not the problem and the form probably has already handcoded elements ;-)
>
>
>>I have a form with a number of the same invisible objects on. I want to make them incrementally visible according to how many records are in a table - 1 object for each record...
>>
>>This code generates a 1925 error - Unknown member "name".
>>
>>
>>zrecs=RECCOUNT()
>>IF zrecs>0
>>	FOR x=1 TO zrecs
>>		thisobject='Dayjobsline'+ALLTRIM(STR(x))
>>		thisform.thisobject.visible=.t.
>>	NEXT
>>ENDIF
>>
>>
>> I have checked the value and type of 'thisobject' by displaying it in a messagebox, and it is all correct, yet I still get the 1925 error.
>>
>>Please advise what I am missing here...
>>
>>Many thanks!!
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform