Simple event handler question

  • Thread starter Thread starter KevinD
  • Start date Start date
K

KevinD

Hi All;

This should be simple, but darn if I can find the answer...

If I do the following:

displayForm form = new displayForm();
form.btnDone.Click += new EventHandler(displayFormBtnDone_Click);
form.ShowDialog();
form.Dispose();

Do I have to ALSO manually disconnect my event handler, or will it be
done automatically when the form is disposed?

I know this is pretty basic, but I'd appreciate someone enlightening
me...

-Kevin
 
When you Dispose the form, it's contained controls are also Disposed, so you
don't need to do anything.

-Chris
 
Ok, I understand, but does an external subscription to a control's
event prevent it from being disposed?

-Kevin
 
Back
Top