Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Initializing variable
Message
 
 
To
15/05/2006 10:57:51
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 6 SP5
OS:
Windows XP SP2
Network:
Windows XP
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01121908
Message ID:
01121921
Views:
8
>>how exactly does one initialise a variable inside a form?
>
>If it is to be used only within a method, the preferred method is to use a local variable. Example:
>
>
>local i
>for i = 1 to ...
>   ...
>next
>
>
>If you need a "variable" in several methods, use a form property. In the following example, the form receives some parameter in the Init() method, and uses it somewhere else.
>
>
>* Form.Init()
>* Receive parameter
>lparameters lcSomeValue
>
>* Create form property and store value
>ThisForm.AddProperty("cSomeValue", lcSomeValue)
>
>
>* Using the property in some other method
>* Form.MyMethod()
>MessageBox("The parameter passed was: " + ThisForm.cSomeValue)
>
Should this message be changed to use tcSomeValue for the parameter declaration? <g>
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform