Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Reference to a form from another form
Message
De
11/04/2013 10:12:27
 
 
À
10/04/2013 17:06:07
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
C# 5.0
OS:
Windows XP SP2
Divers
Thread ID:
01570178
Message ID:
01570736
Vues:
36
>If I have 2 forms and I would like to change a status of a control set on one of the forms from the other form.
>E.g. there is a enabled CheckBox on Form1 and Id like to set it to disabled by a Button on Form2.


I think that my first blog post would be useful for what you want to do. Although the post is about passing data between forms, the same ideas can be used for executing methods from one form to another. In your case, I think you should have a public method on Form1 that sets the enabled value of your CheckBox and the button handler on Form2 should call Form1's method.

~~Bonnie



>
>>>What is the best practice in C# to reference to a form from another form and the form's object?
>>>A link to an article or other thread would be appreciated.

>>
>>Could you give us an example of what you'd like to do? I'm not sure I totally understand what you need. If you need to pass data between forms, I have two blog posts discussing that:
>>
>>http://geek-goddess-bonnie.blogspot.com/2011/01/passing-data-between-forms.html
>>http://geek-goddess-bonnie.blogspot.com/2012/12/passing-data-between-forms-redux_31.html
>>
>>~~Bonnie
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform