Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Local var not local
Message
From
24/10/2001 15:09:43
 
 
To
24/10/2001 14:52:11
John Deupree
Long Term Care Authority
Tulsa, Oklahoma, United States
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Miscellaneous
Thread ID:
00572823
Message ID:
00572836
Views:
24
The FOR loop will terminate when nColNumber is greater than nColumnCount. The comparison is made at the beginning of the loop.

>I have declared a variable local in a form class method, yet it seems not to be local. Here is the code:
>
>
>THISFORM.grdfind.RECORDSOURCE = THIS.ccursorname
>LOCAL nColumnCount, nColNumber
>nColumnCount = THIS.grdfind.COLUMNCOUNT
>
>FOR nColNumber = 1 TO nColumnCount
>	THIS.grdfind.COLUMNS(nColNumber).CONTROLSOURCE = ;
>		THIS.ccursorname + "." + THIS.afieldnames(nColNumber)
>ENDFOR
>
>
>If I run through this method twice it blows up because nColNumber = 5 (nColumnCount = 4). If I suspend the code below the ENDFOR, nColNumber = 5 at the end of the first pass. Is this normal? I thought that nColNumber would never be greater than 4? On the second call to the method, nColNumber starts out at 5. I use this same variable in the calling program (declared local) and another method in the same form class (also local).
>
>TIA
>
>John
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer
Previous
Reply
Map
View

Click here to load this message in the networking platform