hide form using the close button
-
How can i hide my form when the user clicks the Close (X) button? What should i write and under which event?
-
How can i hide my form when the user clicks the Close (X) button? What should i write and under which event?
-
How can i hide my form when the user clicks the Close (X) button? What should i write and under which event?
You should catch the FormClosing event (under Net 1.1 it's just calledc closing event I think):
private void FormTest_FormClosing(object sender, FormClosingEventArgs e) { e.Cancel = true; this.Hide(); }
Greetings, Ingo ------------------------------ A bug in a Microsoft Product? No! It's not a bug it's an undocumented feature! -
You should catch the FormClosing event (under Net 1.1 it's just calledc closing event I think):
private void FormTest_FormClosing(object sender, FormClosingEventArgs e) { e.Cancel = true; this.Hide(); }
Greetings, Ingo ------------------------------ A bug in a Microsoft Product? No! It's not a bug it's an undocumented feature!I've tried using your code but I'm a small problem - I'm using a notify icon class in my project and when i click the close button, my aplication exits instead of hiding.
-
I've tried using your code but I'm a small problem - I'm using a notify icon class in my project and when i click the close button, my aplication exits instead of hiding.
Well I don't know the nofiyicon class but I don't know if this changes somtehing. I tested my code again and my form isn't closed. I put a timer on the form and I'm able to show this form again. What does the NotifyIcon Class on your Form? Greetings, Ingo ------------------------------ A bug in a Microsoft Product? No! It's not a bug it's an undocumented feature!
-
Well I don't know the nofiyicon class but I don't know if this changes somtehing. I tested my code again and my form isn't closed. I put a timer on the form and I'm able to show this form again. What does the NotifyIcon Class on your Form? Greetings, Ingo ------------------------------ A bug in a Microsoft Product? No! It's not a bug it's an undocumented feature!
what an idiot I am. I totally forgot to add the
e.cancel = true;
My bad. -
what an idiot I am. I totally forgot to add the
e.cancel = true;
My bad. -
:) ------------------------------ A bug in a Microsoft Product? No! It's not a bug it's an undocumented feature!
if i set e.cancel = true and this.hide() then the form will not closing..and still it is visible.. i wrote the code in formClosing Event.. Any ideas.. Regards, Saravanna