I had a similar exception, only I was loading a form into a panel on another
form, and then showing other modal forms.
After stripping the form down to just panels & splitters, I was able to get
rid of the exception.
To get rid of the message, I had to put a button on one of the panels and
set visible = false, then added back all the other controls.
Having said that, it's probably not the form you are opening, but the form
that is launching the form you -think- you are getting the message from. As
a last resort, you may want to strip the form down to just basic controls
and see if the error goes away.
Morgan
[quoted text, click to view] "Tilfried Weissenberger" <tilli@NOweissenSPAMberger.at> wrote in message
news:1078441195.81700@news.aic.at...
> 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.
>
>