ListBox crash: bug or my mistake?

  1. last week

    Markus W

    Sep 13 #JeSuisHuman Europe (Germany)...

    I have some initial values set for a ListBox in the IDE. Of course I do not want them in my running app. But I can reliably crash the listbox by simple doing the following in its Open event:

    Sub Open() Handles Open
      me.InitialValue = ""  
      Me.CellType(0, 1) = Listbox.TypeEditableTextField  // <- OutOfBoundsException
    End Sub

    But adding a simple space is enough to prevent the error:

    Sub Open() Handles Open
      me.InitialValue = " "  
      Me.CellType(0, 1) = Listbox.TypeEditableTextField  // <- No more OutOfBoundsException
    End Sub

    Any idea why?

    Because me.InitialValue = "" is the eqivilent to:

    me.DeleteAllRows

    While me.InitialValue = " " is equal to:

    me.DeleteAllRows
    me.addrow " "
  2. Neil B

    Sep 13 Pre-Release Testers Answer

    Because me.InitialValue = "" is the eqivilent to:

    me.DeleteAllRows

    While me.InitialValue = " " is equal to:

    me.DeleteAllRows
    me.addrow " "
  3. Markus W

    Sep 13 #JeSuisHuman Europe (Germany)...

    Thanks Neil.

or Sign Up to reply!