General information
Category:
Coding, syntax & commands
>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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only