Error while filling In a combo box

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ibrahim2008
    New Member
    • Nov 2008
    • 9

    Error while filling In a combo box

    I am trying to fill data in a combo box(comwork) from a record set,but that record set is retrieving nearly 44000 records.While executing this error is coming,"invalid item index."i think that newindex is going to upper bound(32767),th at's this error is coming.

    My code

    rs.open"select wono,woid from workorder,conma in
    do while not rs!eof
    comwo.additem rs!wono
    combo.itemdata( combo.newindex) =rs!woid
    rs.movenext
    loop
    set rs.activeconnec tion=nothing
    if rs.state=1 then rs.close

    please help me to sort out this problem.

    Regards,
    Ibrahim
  • QVeen72
    Recognized Expert Top Contributor
    • Oct 2006
    • 1445

    #2
    Hi,

    Yes, thats the limitation for ComboBox if you are using ItemData..
    Try to Use "ListView" Control, Have 2 columns,
    Populate one Column with Name/text and another with ID, and Hide the second column...
    ListView has got higherMax Range..

    Regards
    Veena

    Comment

    • rpicilli
      New Member
      • Aug 2008
      • 77

      #3
      HI

      I do not use VB I use VB.NET. I made some tests and there is no limitation in the combo box.

      You'd certity that you table has the correct data. I saw that you use the WOID as index in a combo. If you have 2 equal numbers in this field you'll have problem.

      Try a for comand like the one below to verify is the problem is the upper limit of the combo.

      Code:
              For i As Integer = 0 To 50000
                  Me.ComboBox1.Items.Add(i.ToString)
              Next
      I hope this help you.

      Rpicilli

      Comment

      • debasisdas
        Recognized Expert Expert
        • Dec 2006
        • 8119

        #4
        Originally posted by rpicilli
        HI

        I do not use VB I use VB.NET. I made some tests and there is no limitation in the combo box.

        Rpicilli
        Rpicilli please do not post .net solutions to VB 6.0 questions.

        Comment

        • rpicilli
          New Member
          • Aug 2008
          • 77

          #5
          OK. I'm sorry.

          BTW is there a difference betwen the codes? VB6 and VB.net?

          Comment

          Working...