When a user clicks the X button on a form, how can I hide it instead of closing it?
I have tried this.hide() in FormClosing but it still closes the form.
this.hide()
FormClosing
Like so:
private void MyForm_FormClosing(object sender, FormClosingEventArgs e) { if (e.CloseReason == CloseReason.UserClosing) { e.Cancel = true; Hide(); } }
(via Tim Huffman)
2.1m questions
2.1m answers
60 comments
57.0k users