T
Tilfried Weissenberger
Hi,
applies to Framework Version 1.1
I have a very funny problem with DropDowns used in forms.
The problem is as follows:
I have a form with a dropdown on it. Opening one instance of it and closing
it again is not a problem. All code from the form_closing event is executed
and the form is shutdown.
BUT if I open 2 instances of this form, and close one of them, the following
exception is thrown. BUT - it's only thrown, if I have a MessageBox.Show
statement in my form_closing event. If I remove that line, the form doesn't
crash.
Note: all code in form_closing is executed, the exception is thrown sometime
after that event is fired. The closed form is being moved behind the still
open form and the WinForms JIT error is thrown:
System.NullReferenceException: Object reference not set to an instance of an
object.
at System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr
wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at System.Windows.Forms.NativeWindow.DefWndProc(Message& m)
at System.Windows.Forms.Control.DefWndProc(Message& m)
at System.Windows.Forms.Control.WmCommand(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ComboBox.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd,
Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr
wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at System.Windows.Forms.ComboBox.DefChildWndProc(Message& m)
at System.Windows.Forms.ComboBox.ChildWndProc(Message& m)
at System.Windows.Forms.ChildWindow.Callback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)
Additional note: apart from this reproducable error, I also get this error
occasionally, when I click into the dropdown. Instead of showing me the
list, I also get this or a similar error, with none of my code involved.
applies to Framework Version 1.1
I have a very funny problem with DropDowns used in forms.
The problem is as follows:
I have a form with a dropdown on it. Opening one instance of it and closing
it again is not a problem. All code from the form_closing event is executed
and the form is shutdown.
BUT if I open 2 instances of this form, and close one of them, the following
exception is thrown. BUT - it's only thrown, if I have a MessageBox.Show
statement in my form_closing event. If I remove that line, the form doesn't
crash.
Note: all code in form_closing is executed, the exception is thrown sometime
after that event is fired. The closed form is being moved behind the still
open form and the WinForms JIT error is thrown:
System.NullReferenceException: Object reference not set to an instance of an
object.
at System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr
wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at System.Windows.Forms.NativeWindow.DefWndProc(Message& m)
at System.Windows.Forms.Control.DefWndProc(Message& m)
at System.Windows.Forms.Control.WmCommand(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ComboBox.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd,
Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr
wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at System.Windows.Forms.ComboBox.DefChildWndProc(Message& m)
at System.Windows.Forms.ComboBox.ChildWndProc(Message& m)
at System.Windows.Forms.ChildWindow.Callback(IntPtr hWnd, Int32 msg,
IntPtr wparam, IntPtr lparam)
Additional note: apart from this reproducable error, I also get this error
occasionally, when I click into the dropdown. Instead of showing me the
list, I also get this or a similar error, with none of my code involved.