Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Private VS Public
Message
 
To
26/03/1999 12:20:08
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00202443
Message ID:
00202783
Views:
17
>Is there a way to initialize Private variables in a form and have them viewable to all methods on the form. I have tried initializing them in both the load and init methods but privates then are not seen in any of the other methods of that form.
>
>Any help would be appreciated.
>
>
>Thanks

John --

Based on the information you gave, I do not think that a PRIVATE MemVar is what you want. If you create a form property, it will be visible to all of the form's objects and methods.

Example: Create a form property called fnCounter. Now use the form's property sheet to examine fnCounter -- its value will be initialized to .F., but you can change it to anything you want. You can refer to fnCounter in any of the form's methods (or in any of the form's object's methods) as ThisForm.fnCounter.

I suppose that fnCounter "sort of" behaves like a PRIVATEly-scoped MemVar, if you are thinking in terms of FoxPro 2.x. As a general rule, though, it might be a good idea to try and steer away from using PRIVATE and PUBLIC scoping in VFP.

Bill
Previous
Reply
Map
View

Click here to load this message in the networking platform