Click here to Skip to main content
15,896,153 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have a 3 form in C#
form1 in mdiform,one menubar in form1
in form2 is one button.
in form3 is one label.
now when i load form1 i load form2 with form1's load event
such as form1 and form2 are load sametime
i write following code of click menubar in form1
<br />
form3 f=new form3();<br />
f.mdiparant=this;<br />
f.show();<br />

when i click menubar at runtime i show form3 in form1

now i want if i click button in form2 i show form3 in form1 and form2 are close

same condition of menubar click?

so what i do you do?

thanks in advance.
Posted

Set up delegates between the forms so they can send each other messages. NEVER use Show to show a form that was created locally, use a member variable so the instance is not lost to you.
 
Share this answer
 
This article

http://www.codeproject.com/Tips/55555/Pass-value-between-forms-using-events.aspx[^]

Demonstrates a similar principal that you can adapt to your needs.

Set up an event delegate in form2 that raises an event in form1.

When the event is raised, form1 closes form2 and opens form3.

Good luck
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900