NullReferenceException in DestroyWindow on dialog close

G

Guest

One of my users is getting a NullReferenceException (Object reference not set
to an instance of an object) when they hit the Ok button on one of my dialogs.

Below is the exception's stack trace:

at System.Windows.Forms.UnsafeNativeMethods.IntDestroyWindow(HandleRef hWnd)
at System.Windows.Forms.UnsafeNativeMethods.DestroyWindow(HandleRef hWnd)
at System.Windows.Forms.NativeWindow.DestroyHandle()
at System.Windows.Forms.Control.DestroyHandle()
at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
at System.Windows.Forms.Form.ShowDialog()

The form does contain a ActiveX control, although I'm not sure if it makes a
difference. I seem unable to reproduce the error on other machines. What
could this error be caused by?
 
G

Guest

It appears calling Dispose() on the activex control during the Closing event
will fix this. Why, I have no idea.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top