We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Easy one: (?) how to kill instance of form class?

I was wondering if there is a way to completely get rid of a form instance, no matter who has references to it. Suppose that I have a datatable on form frmList. I show frmDetail from a button of form list: dim f as new frmDetail f.Show Now suppose frmDetail adds a handler to a datatable that lives on frmList: AddHandler dtList.ColumnChanged, AddressOf ccHdlr Even If I put me.Dispose in frmDetail's closed event, changes to the datatable call the handler for the previous insantce of frmDetail. I thought my form was gone when I closed it, but it lives on through the handler. I know I can remove the handler in frmClosed. I was just wondering how to really trash the form, even if some other objects have references to it.

1 Reply

RP Ramesh Praveen Syncfusion Team April 8, 2003 07:04 PM UTC

You cannot do this. Whenever you do a AddHandler you should also do a ReleaseHandler (in this case in your form's Dispose) so that outstanding references will be removed. -Praveen

Live Chat Icon For mobile
Up arrow icon