Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How do you return data from a modal Form object?
Message
 
À
17/03/1998 14:13:20
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Divers
Thread ID:
00085149
Message ID:
00085185
Vues:
41
>The simplistic way is following:
>PUBLIC gVar1 && it's better to use oApp property here
>gVar1=""
>createobject(...) && and reset gVar1 in e.g. Newform.Destroy event

Ed,

The above code works exactly the same way if the var is NOT declared PUBLIC. The only time a PUBLIC declaration would be needed would be if the program above was going to return and then some other program needed to access the variable. If this is the case then there is a design problem since the program that will use the variable did not create it.

I know that YOU know this, but I sense that many others do not know this adn that there are alot of variables being delcared as public unnecessarily. PUBLIC variable remain defiend long after the program that defines them is gone. PUBLIC variables have the potential of stomping all over everything else that is in memory at the time they are declared. The only safe way to declare a memvar public is to release it first, because if there any var with name anywhere and error will occur on the PUBLIC line. That means if;

IOW, PUBLIC is a dirty word and should not be typed in any program. The requirement for "global" variables can be met by creating the variable in the startup program (the one with teh read events).

Otherwise the code you posted would be fine for getting the value back fromt eh called form.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform