Results 1 to 3 of 3

Thread: [RESOLVED] combo box

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2006
    Location
    USA
    Posts
    122

    Resolved [RESOLVED] combo box

    the following code adds items to a combo box. however it throws an error when it gets to 5 because there is no row at 5. how do i prevent this

    Dim length As Integer = ds.Tables(0).Rows.Count()

    For i As Integer = 1 To length
    Dim wineid As String
    wineid = ds.Tables(0).Rows(i)("WineId").ToString()
    Me.cboWineID.Items.Add(wineid)
    Me.cboWineID.DisplayMember = "WineId"
    Next

    thanks in advance

    notrosh

  2. #2
    Frenzied Member Asgorath's Avatar
    Join Date
    Sep 2004
    Location
    Saturn
    Posts
    2,036

    Re: combo box

    VB Code:
    1. For i As Integer = 0 To ds.Tables(0).Rows.Count() -1
    2. Dim wineid As String
    3. wineid = ds.Tables(0).Rows(i)("WineId").ToString()
    4. Me.cboWineID.Items.Add(wineid)
    5. Me.cboWineID.DisplayMember = "WineId"
    6. Next
    "The dark side clouds everything. Impossible to see the future is."

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Oct 2006
    Location
    USA
    Posts
    122

    Re: combo box

    thanks

    I figured that out after i looked at it a little more

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width