Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Alternatives to Public Variables?
Message
De
09/10/1999 08:30:15
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire d'écran & Écrans
Divers
Thread ID:
00273561
Message ID:
00274578
Vues:
27
>>whats the difference, then, between a PRIVATE variable that is available to the whole application by being declared in the startup and a PUBLIC variable declared later?
>
>Private variables go away when the routine that creates them ends, publics don't go away until VFP quits or they are released using the release command.

>
>Public variables can interfere with other routines. In COM objects they can, under certain conditions, interfere with other COM server instances.
>
>Another difference, if you are distributing a system that is contained in multiple APP files, each app file can have its own set of privates. If an app declared a var public that already existedf in another routine, you would get and error.
>

so if we're running a standalone application (and only then) it doesn't really matter which you use because as soon as you leave the app, all variables will be released anyway...

>>indeed, in fact, what I have been doing up to now, is whenever I've found a need for a public variable, I initialise all of them in the same place - a "re_init" prg which establishes all the variables at the beginning of the app loop.
>
>I would just move it to a place in teh startup.prg

I can see the sense of that...
>
>>but when you do need them, how do you get around the inability to use the syntax " &thisform.property" ?
>
>
>lcMacro = Thisform.Property
>&lcMacro

thats what I was afraid you'd say!

ach well, lets get hacking...

Thanks Jim

Harry
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform