NRE opening combobox dropdown menu

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Andrus

    NRE opening combobox dropdown menu

    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.DataGridV iewComboBoxCell .ComboBox_DropD own()

    which causes this error ?


    Andrus.

    System.NullRefe renceException was unhandled
    Message="Object reference not set to an instance of an object."
    Source="System. Windows.Forms"
    StackTrace:
    at
    System.Windows. Forms.DataGridV iewComboBoxCell .ComboBox_DropD own(Object
    sender, EventArgs e)
    at System.EventHan dler.Invoke(Obj ect sender, EventArgs e)
    at System.Windows. Forms.ComboBox. OnDropDown(Even tArgs e)
    at myApp.myComboBo x.OnDropDown(Ev entArgs e) in myComboBox.cs:l ine 71
    at System.Windows. Forms.ComboBox. WmReflectComman d(Message& m)
    at System.Windows. Forms.ComboBox. WndProc(Message & m)
    at
    System.Windows. Forms.Control.C ontrolNativeWin dow.OnMessage(M essage& m)
    at System.Windows. Forms.Control.C ontrolNativeWin dow.WndProc(Mes sage&
    m)
    at System.Windows. Forms.NativeWin dow.DebuggableC allback(IntPtr hWnd,
    Int32 msg, IntPtr wparam, IntPtr lparam)
    at System.Windows. Forms.UnsafeNat iveMethods.Send Message(HandleR ef
    hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
    at System.Windows. Forms.Control.S endMessage(Int3 2 msg, IntPtr wparam,
    IntPtr lparam)
    at System.Windows. Forms.Control.R eflectMessageIn ternal(IntPtr hWnd,
    Message& m)
    at System.Windows. Forms.Control.W mCommand(Messag e& m)
    at System.Windows. Forms.Control.W ndProc(Message& m)
    at System.Windows. Forms.Scrollabl eControl.WndPro c(Message& m)
    at
    System.Windows. Forms.Control.C ontrolNativeWin dow.OnMessage(M essage& m)
    at System.Windows. Forms.Control.C ontrolNativeWin dow.WndProc(Mes sage&
    m)
    at System.Windows. Forms.NativeWin dow.DebuggableC allback(IntPtr hWnd,
    Int32 msg, IntPtr wparam, IntPtr lparam)
    at System.Windows. Forms.UnsafeNat iveMethods.Call WindowProc(IntP tr
    wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
    at System.Windows. Forms.NativeWin dow.DefWndProc( Message& m)
    at System.Windows. Forms.ComboBox. DefChildWndProc (Message& m)
    at System.Windows. Forms.ComboBox. ChildWndProc(Me ssage& m)
    at
    System.Windows. Forms.ComboBox. ComboBoxChildNa tiveWindow.WndP roc(Message& m)
    at System.Windows. Forms.NativeWin dow.DebuggableC allback(IntPtr hWnd,
    Int32 msg, IntPtr wparam, IntPtr lparam)
    at System.Windows. Forms.UnsafeNat iveMethods.Disp atchMessageW(MS G&
    msg)
    at
    System.Windows. Forms.Applicati on.ComponentMan ager.System.Win dows.Forms.Unsa feNativeMethods .IMsoComponentM anager.FPushMes sageLoop(Int32
    dwComponentID, Int32 reason, Int32 pvLoopData)
    at
    System.Windows. Forms.Applicati on.ThreadContex t.RunMessageLoo pInner(Int32
    reason, ApplicationCont ext context)
    at
    System.Windows. Forms.Applicati on.ThreadContex t.RunMessageLoo p(Int32 reason,
    ApplicationCont ext context)
    at System.Windows. Forms.Applicati on.Run(Form mainForm)
    .....


  • Andrus

    #2
    Re: NRE opening combobox dropdown menu

    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(Syst em.EventArgs e) {
    base.OnDropDown (e);

    }

    after I removed this line by creating empty procedure:

    protected override void OnDropDown(Syst em.EventArgs e) {

    }

    NullReferenceEx ception disappears.

    Any idea why ?

    Andrus.


    Comment

    • =?Utf-8?B?TW9ydGVuIFdlbm5ldmlrIFtDIyBNVlBd?=

      #3
      Re: NRE opening combobox dropdown menu

      "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(Syst em.EventArgs e) {
      base.OnDropDown (e);
      >
      }
      >
      after I removed this line by creating empty procedure:
      >
      protected override void OnDropDown(Syst em.EventArgs e) {
      >
      }
      >
      NullReferenceEx ception 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]

      Comment

      Working...