Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Reference to a form from another form
Message
From
11/04/2013 10:12:27
 
 
To
10/04/2013 17:06:07
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
C# 5.0
OS:
Windows XP SP2
Miscellaneous
Thread ID:
01570178
Message ID:
01570736
Views:
37
>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
Previous
Reply
Map
View

Click here to load this message in the networking platform