Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Variable not releasing from button
Message
From
12/12/2008 09:13:21
 
General information
Forum:
Visual FoxPro
Category:
Forms & Form designer
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows NT
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01366777
Message ID:
01366913
Views:
8
>Dan,
>
>There is no need to release the variable if you are going to declare it as a local. Your problem is not with the variable. Your variable is being set to the value of a textbox in the grid and personally that is not a good way to handle things because it gets confusing as to which record is the current row for the grid. You would be better off reading the field in the grid's recordsource as in;
>
>
>* This should probably be done in the form's Init or load event once 
>* rather than setting it again every time the button gets hit
>set procedure to wwutils additive
>
>* Declare the variable as local and any other variables with that name are hidden
>Local lnpubll
>
>lnpubll = MyTable.Fieldname && Read the data from the table or cursor that is under the grid
>GoUrl (("http://www.mywebsite/") + urlencode(alltrim(lnpubll)))
>
>* No need to release the variable as it will go out of scope once this method ends.
>
>
>In fact you can eliminate the variable all together with this approach;
>
>
>* This should probably be done in the form's Init or load event once 
>* rather than setting it again every time the button gets hit
>set procedure to wwutils additive
>
>GoUrl (("http://www.mywebsite/") + urlencode(alltrim(MyTable.Fieldname)))
>
Thanks Jim,

Your procedure works well. I'm still curious as to why the variable in my original code couldn't be cleared or reset? Didn't matter if it was local or public, closing and reopening the form cleared it, but I couldn't get it to clear while the form was open.

Thanks again,
Dan
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform