Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Newbie Question - Why does this work?
Message
De
02/11/2009 14:28:26
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
 
 
À
02/11/2009 13:00:29
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Divers
Thread ID:
01432708
Message ID:
01432755
Vues:
47
>Viv
>
>Thanks for the reply.
>
>The callled form was closed by clicking a button on the called form with:
>this.close
>in the click event handler.
>
>Apparently, that doesn't "release" it, it just "hides" it, because I can access its properties from the calling form afer this.close has been executed.
>
>That's really handy in this case, but I'd like to get rid of it and I'm wondering how.
>
>
>
>
>>>newbie question is .. why does this work? or put another way when does the called form object disappear in C#?
>
>When myGetHolderForm goes out of scope or you specifically close it. .ShowDialog basically just shows the form as Modal...
>Hope this helps,
>Viv

Viv was right in the response also. When the method you have this code in goes out of scope, the reference will also go out of scope. Your reference is this one.
GetHolderForm myGetHolderForm = new GetHolderForm();
if you were to put the reference in your class rather than in a method and set it only in your method, then it would be in scope until the class goes out of scope.
// In the class
GetHolderForm myGetHolderForm;

// In your method
myGetHolderForm = new GetHolderForm();
Tim
Timothy Bryan
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform