Closing formPJPer Jespersen16yAsked Sep 29, 2010, 5:42 AM2.4kLearn iOS ProgrammingI would like to execute some stuff when I close my form. Isn't there a function called: private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e) { }But it doesn't work for me.
Felipe Ramos16y agoPosted Sep 29, 2010, 9:29 AMYou can override both or just the last one. protected override void OnClosing(CancelEventArgs e) { base.OnClosing(e); } protected override void OnClosed(EventArgs e) { base.OnClosed(e); }0
PJPer Jespersen16y agoPosted Sep 29, 2010, 6:33 AMOk. I've tried that. But the method "FileMonitorApp_FormClosing()" isn't executed, when I close that window. I don't know why.0
KMKoteswararao Mallisetti16y agoPosted Sep 29, 2010, 6:05 AMform _closing take only 2 arguments the syntax is like this private void FileMonitorApp_FormClosing(object sender, FormClosingEventArgs e) { MessageBox.Show("in the closing"); } private void FileMonitorApp_FormClosed(object sender, FormClosedEventArgs e) { MessageBox.Show("in the closed"); }suppose you have to undo the closing use the e.Cancel = true; in the closing event then the form is available0
Felipe RamosPosted Sep 29, 2010, 9:29 AM
Per JespersenPosted Sep 29, 2010, 6:33 AM
Koteswararao MallisettiPosted Sep 29, 2010, 6:05 AM
private void FileMonitorApp_FormClosing(object sender, FormClosingEventArgs e)
{
MessageBox.Show("in the closing");
}
private void FileMonitorApp_FormClosed(object sender, FormClosedEventArgs e)
{
MessageBox.Show("in the closed");
}
suppose you have to undo the closing use the
e.Cancel = true; in the closing event then the form is available