Looping in Datagridview

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

    #1

    Looping in Datagridview

    Mine is a windows app. containing forms named BOM nd BOMSelected..

    There is datagridview in BOM which contains checkbox column.. When the user selects checkbox, the selected rows should be seen in the datagridview of other form, SelectedBom..

    I have coded but don't get it working.. Some error..

    Can you please help ??

    Your Help is greatly appreciated..

    Here is what i have done !!

    Code:
    Public Class SelectedBom
    
        Private Sub SelectedBom_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            'TODO: This line of code loads data into the 'HemDatabase1DataSet4.partno' table. You can move, or remove it, as needed.
            'Me.PartnoTableAdapter.Fill(Me.HemDatabase1DataSet4.partno)
    
            Dim count As Integer = 0
    
            For j As Integer = 0 To BOM.dgv1.RowCount - 1
    
                If BOM.dgv1.Rows(j).Cells(0).Value = True Then
    
                    Dim ro As New DataGridViewRow
                    DataGridView2.Rows.Add(ro)
    
                    For i As Integer = 0 To BOM.dgv1.ColumnCount - 1
                        Me.DataGridView2.Rows(count).Cells(i).Value = BOM.dgv1.Rows(j).Cells(i).Value
                    Next
    
                    count += 1
    
                End If
    
            Next
    
        End Sub
    End Class
    The attachment shows the output I have obtained !! Please help..
    Attached Files
Working...