EventHandler for Child Form Closed Event?
-
In my project I've created an instance of a custom form class. In my form class, I have error detection that simply closes the form if an un-handleable error occurs. Due to the nature of the app, this is the desired behavior. However, I would like an event on the main form to fire off whenever this happens. How can I do this? I initialize my custom for like this:
frm_myForm myForm = new frm_myForm();
For any other control I want to add a handler for, I would do something like this:btnShowForm.Click += new System.EventHandler(btnShowForm_Click);
... and create the corresponding function. I applied similar logic to my form instance but it doesn't seem to work that way. (myForm.Closed += new blah blah). Am I missing a key concept here? It seems like this would be functionality used all the time so I fear I'm being dense and not seeing the big picture. Any advice is appreciated... Alan -
In my project I've created an instance of a custom form class. In my form class, I have error detection that simply closes the form if an un-handleable error occurs. Due to the nature of the app, this is the desired behavior. However, I would like an event on the main form to fire off whenever this happens. How can I do this? I initialize my custom for like this:
frm_myForm myForm = new frm_myForm();
For any other control I want to add a handler for, I would do something like this:btnShowForm.Click += new System.EventHandler(btnShowForm_Click);
... and create the corresponding function. I applied similar logic to my form instance but it doesn't seem to work that way. (myForm.Closed += new blah blah). Am I missing a key concept here? It seems like this would be functionality used all the time so I fear I'm being dense and not seeing the big picture. Any advice is appreciated... Alan -
alanteigne wrote:
frm_myForm myForm = new frm_myForm();
myForm.FormClosed += new FormClosedEventHandler(myForm_FormClosed);
FormClosed. You've gotta be kidding me, that makes too much sense! Thanks!