Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Local vs private
Message
De
12/08/2005 12:14:14
 
 
À
12/08/2005 11:39:17
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01039725
Message ID:
01040577
Vues:
19
I would expect you to get an error with PRIVATE, as when the Load event terminates, the variable goes out of scope. frmSwitchboard in Load is a different variable than frmSwitchboard in Destroy. In appears that variable scoping is not the issue, but rather a misunderstanding of how methods are working.

When a form is loaded, one method does not call another, but rather each is run independently. A variable declared in one method goes out of scope (destroyed) when the method terminates.

>Thanks to all of you who have shared thoughts on this subject. I gave it a try in my current application and this is what I found. In the load event of my first form I place:
>
>private frmSwitchboard
>frmSwitchboard = thisform
>
>Then in a button on frmSwitchboard I place
>
>frmSwitchboard.visible = .f.
>do form frmForm2
>
>In the destroy event of frmForm2 I place
>
>frmSwitchboard.visible = .t.
>
>At this point I get an error that effectively says it can't see frmSwitchboard. Now if frmForm2 was called by frmSwitchboard, why can't frmForm2 see it?
>
>Incidentally, if I replace the PRIVATE statement with a PUBLIC one, the problem goes away.
>
>- Don
>
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform