Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Where is the best place to declare public variables?
Message
From
24/08/2000 15:19:05
 
 
To
24/08/2000 15:12:09
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00408953
Message ID:
00408959
Views:
19
>Is it in a main.prg, or in the init event of a form, or at the beginning of a program?
>Do I have to release all those variables after using them?
>What happens if I don't?
>I've seen some posts of people not wanting to use public variables. What's wrong with PV's?
>
>TIA
>Ulises.

Nothing's that wrong with them, there's just better ways of getting the fuctionality they used to provide.
In my apps I do have one PUBLIC variable = my application object - this guy gets created in the main.prg. 99% of the time, though, I only need a variable to be accessible by any object on a form. If you find that's the case for you, create custom form properties to hold these values instead.

You don't necessarily have to release them (although with objects it's a good idea), but you have to be aware that changing their values in one process could affect another process that may have relied on the original values.
Insanity: Doing the same thing over and over and expecting different results.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform