Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Defining a global property for an application
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00357663
Message ID:
00357764
Views:
12
>>>VFP 5.
>>>
>>>I have forgotten how to do the following.
>>>1. Define a property that is accessible anywhere in the application.
>>>2. Use it in forms or other programs.
>>>
>>>Any help appreciated.
>>
>>In your main prg declare a variable as PUBLIC
>>
>>It is always a good practice to track the PUBLIC variables very closely.
>
>Bret,
>
>There is no reason that a variable declared in the start up program of an application needs to be PUBLIC! A private variable is visible to everything in the application.

Hi Jim,

I made the same assumption, but it's not a truly right. I declare a private variable in a main program pcTable and assign pcTable='' (This is important to assign a value, before using a variable). Then I create a form and test, if this variable is still visible. I found, that if I issue Read Events after
do form MyForm, this variable is still visible in all methods and events, otherwise this variable is visible only for Init and then it becomes out of scope. You can test it.

Thanks.
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