Looping in Datagridview

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ruchi22
    New Member
    • Oct 2011
    • 6

    Looping in Datagridview

    I have a datagridview with checkbox column in form1.. When the user selects certain rows with checkbox, I wish those selected rows be visible in datagridview in form2..

    Here is what i did..

    First looped through rows with j, in the rows, counted columns available via i and then, tried to obtain the checked values..

    Code:
    
            For j As Integer = 0 To Form1.dgv1.RowCount - 1
    
                If Form1.dgv1.Rows(0).Cells(0).Value = True Then
    
                    For i As Integer = 0 To Form1.dgv1.ColumnCount - 1
                        Me.dgv2.Rows(0).Cells(i).Value = Form1.dgv1.Rows(0).Cells(i).Value
                    Next
    
                End If
    
            Next
Working...