Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Initializing variable
Message
From
15/05/2006 10:57:51
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
15/05/2006 10:47:10
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:
01121913
Views:
9
>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 tcSomeValue

* Create form property and store value
ThisForm.AddProperty("cSomeValue", m.tcSomeValue)


* Using the property in some other method
* Form.MyMethod()
MessageBox("The parameter passed was: " + ThisForm.cSomeValue)
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform