dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: looping through a table, select some rows

  1. #1
    Join Date
    Nov 2007
    Posts
    30

    looping through a table, select some rows

    i made a code for looping in table and find the values that match with one value from a array, then return the content of one column from that row, but my code don't work correctly

    Code:
    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
            txt_team1.Items.Clear()
            Dim lineup_byte() As Byte = New Byte() {}
            Dim lineUp() As Long = New Long() {}
            Dim row As DataRowView = dtTeam.DefaultView.Item(ComboBox1.SelectedIndex)
            lineup_byte = row("lineup")
            Dim myLineUp As New Teams.LineUp
            myLineUp.Get_Team_LineUp = lineup_byte
            lineUp = myLineUp.LineUp
            For Each row In dtPlayer.DefaultView
                For i As Integer = 0 To lineUp.Length - 1
                    If lineUp(i) = row("pid") Then
                        txt_team1.Items.Add(row("name"))
                    End If
                Next i
            Next row
        End Sub

  2. #2
    Join Date
    Jun 2004
    Location
    Kashmir, India
    Posts
    6,808

    Re: looping through a table, select some rows

    What does Not Working Properly mean?
    Does it give any error or is it not producing proper results? Also instead of looping, you could use a simple Where Condition on your dataset.

  3. #3
    Join Date
    Nov 2007
    Posts
    30

    Re: looping through a table, select some rows

    i fixed it thanks a lot anyway for reading..now i have a new problem

    now i have 2 listboxes , both with 32 items, i want to do a drag&drop feature from one to another, and the source listbox item becomes string "DUMMY", and the replaced item from 2nd becomes listbox1 item string.
    i also want to use a third listbox, to drag items from.to one of the 2 listboxes..
    can anyone show me an example code to do this?

  4. #4
    Join Date
    Jun 2004
    Location
    Kashmir, India
    Posts
    6,808

    Re: looping through a table, select some rows


Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)