By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,530 Members | 891 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,530 IT Pros & Developers. It's quick & easy.

NRE opening combobox dropdown menu

P: n/a
SWF DataGridView contains combobox control.
Activating combobox and pressing F4 to open dropdown menu causes strange NRE
(see below).

When I enter some valid value to combobox, press tab, shift+tab , 44
dropdown menu opens OK.

How to fix ?

How to use VCSE 2008 with .net framework source code to find the line in

System.Windows.Forms.DataGridViewComboBoxCell.Comb oBox_DropDown()

which causes this error ?
Andrus.

System.NullReferenceException was unhandled
Message="Object reference not set to an instance of an object."
Source="System.Windows.Forms"
StackTrace:
at
System.Windows.Forms.DataGridViewComboBoxCell.Comb oBox_DropDown(Object
sender, EventArgs e)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Windows.Forms.ComboBox.OnDropDown(EventArgs e)
at myApp.myComboBox.OnDropDown(EventArgs e) in myComboBox.cs:line 71
at System.Windows.Forms.ComboBox.WmReflectCommand(Mes sage& m)
at System.Windows.Forms.ComboBox.WndProc(Message& m)
at
System.Windows.Forms.Control.ControlNativeWindow.O nMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message&
m)
at System.Windows.Forms.NativeWindow.DebuggableCallba ck(IntPtr hWnd,
Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.SendMessa ge(HandleRef
hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at System.Windows.Forms.Control.SendMessage(Int32 msg, IntPtr wparam,
IntPtr lparam)
at System.Windows.Forms.Control.ReflectMessageInterna l(IntPtr hWnd,
Message& m)
at System.Windows.Forms.Control.WmCommand(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Mes sage& m)
at
System.Windows.Forms.Control.ControlNativeWindow.O nMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message&
m)
at System.Windows.Forms.NativeWindow.DebuggableCallba ck(IntPtr hWnd,
Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.CallWindo wProc(IntPtr
wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at System.Windows.Forms.NativeWindow.DefWndProc(Messa ge& m)
at System.Windows.Forms.ComboBox.DefChildWndProc(Mess age& m)
at System.Windows.Forms.ComboBox.ChildWndProc(Message & m)
at
System.Windows.Forms.ComboBox.ComboBoxChildNativeW indow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallba ck(IntPtr hWnd,
Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchM essageW(MSG&
msg)
at
System.Windows.Forms.Application.ComponentManager. System.Windows.Forms.UnsafeNativeMethods.IMsoCompo nentManager.FPushMessageLoop(Int32
dwComponentID, Int32 reason, Int32 pvLoopData)
at
System.Windows.Forms.Application.ThreadContext.Run MessageLoopInner(Int32
reason, ApplicationContext context)
at
System.Windows.Forms.Application.ThreadContext.Run MessageLoop(Int32 reason,
ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
.....
Feb 10 '08 #1
Share this Question
Share on Google+
2 Replies


P: n/a
I was unable to reproduce your issue using a simple DataGridView and a
ComboBoxColumn. F4 worked just as expected. It does, however, appear
that
you have a custom ComboBox control in the grid and I would take a closer
look
at line 71 in myComboBox.cs.
line 71 is only line, base.OnDropDown(e) in OnDropDown()

protected override void OnDropDown(System.EventArgs e) {
base.OnDropDown(e);

}

after I removed this line by creating empty procedure:

protected override void OnDropDown(System.EventArgs e) {

}

NullReferenceException disappears.

Any idea why ?

Andrus.
Feb 11 '08 #2

P: n/a
"Andrus" wrote:
I was unable to reproduce your issue using a simple DataGridView and a
ComboBoxColumn. F4 worked just as expected. It does, however, appear
that
you have a custom ComboBox control in the grid and I would take a closer
look
at line 71 in myComboBox.cs.

line 71 is only line, base.OnDropDown(e) in OnDropDown()

protected override void OnDropDown(System.EventArgs e) {
base.OnDropDown(e);

}

after I removed this line by creating empty procedure:

protected override void OnDropDown(System.EventArgs e) {

}

NullReferenceException disappears.

Any idea why ?

Andrus.

I couldn't say. If you have VS 2008 you could try stepping into the
base.OnDropDown(e) method and see what it does.

--
Happy Coding!
Morten Wennevik [C# MVP]

Feb 12 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.