Click here to Skip to main content
15,885,878 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm trying to create a management system, but after doing several tasks while I'm about to switch form my program getting closed automatically.


I've tried other methods as well but not working.
I've used this method to hide and show forms:

What I have tried:

this.Hide();
Form2 f=new Form2();
f.Show();
Posted
Updated 21-Sep-20 9:19am

1 solution

It's not being closed, it's being hidden - you specifically tell it to hide:
this.Hide();

What you need to do is call Show on it again when your Form2 closes, and the best way to do that is to handle the Form2 FormClosing event: Form.FormClosing Event (System.Windows.Forms) | Microsoft Docs[^] and call Show in the handler.
 
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