Here is the issue:
I have a multi-form application developed on C# with two forms, after I press a button I hide the first form and show the second, but how can I show the first form again if I close the second one pressing the red close button on the upper right of my window?
The FormClosing event doesn´t get this action...
Plz help me and Thanx for any answer

jacg4
Recommended Answers
Jump to PostWhat you might want to consider is the following:
Disable the X close option for form 2 and instead put a button within the form that will perform the tasks of re-showing the first form and closing the 2nd.
Alternately, the FormClosing event SHOULD catch the close of …
Jump to Postcreate a new event handler in
Form2.designer
ex:this.form2_unload += new System.Windows.Forms.EventHandler(this.Form2_unload);
then:
private MainForm gg; public Form2(Project1.Form1 p) { InitializeComponent(); this.Owner = p; gg = p; } private void Form2_unload(object sender, EventArgs e) { gg.form1.show(); //or form1.visible = true; this.close(); } …
Jump to PostDon't forget to mark the thread solved if your problem is resolved by any of the above suggestions or on your own. That way people don't think the issue is ongoing :)
All 10 Replies
Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster
vsa000 1 Newbie Poster
hirenpatel53 -1 Posting Whiz in Training
hirenpatel53 -1 Posting Whiz in Training

jacg4
Lusiphur 185 Practically a Posting Shark Team Colleague Featured Poster

jacg4
Geekitygeek 480 Nearly a Posting Virtuoso

jacg4
Geekitygeek 480 Nearly a Posting Virtuoso
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.