Hey guys,

I want my form to hide instead to close by clicking on the red X button. Because when it's closed the form is deleted.
I searched a lot to find a good solution, but nothing works.
Many people wrote that following code:

private void Form1_OnClosing(object sender, FormClosingEventArgs e)
            e.Cancel = true;

would solve the problem. I tried it. My Form is not hiding. I don't know what I did wrong.
I would be very happy if you could help me.

Thanks :)

You forgot to manually bind the form event to that method.. is it being fired?

add this.FormClosing += new FormClosingEventHandler(Form1_OnClosing);

in your form load method

It works, you are a genius :)

I'm a newbie therefore I don't know such things.
Thank you so much :)

he is not a genious. He only knows more.

jfarrugia btw, next time what is the code, you have to put it into code brackets!
I hope you understand (forum rules).