Hi
I got 2 datagrid and single column. Datagrid 1 contains 2 rows number 2 and 3. Datagrid2 contains 1, 2 and 3. I want to remove the duplicate numbers on datagrid2. The tables are unrelated so i would have to use cursors.
VB Code:
Try Dim a As String For i As Integer = 0 To ds1.Tables(0).Rows.Count - 1 a = Me.DataGrid1.Item(i, 0).ToString.TrimEnd For Each row As DataRow In ds2.Tables(0).Rows ''Console.WriteLine(row.Item(0).ToString) If row.Item(0).ToString = a Then ds2.Tables(0).Rows.Remove(row) End If Next Next Catch ex As Exception Console.WriteLine(ex.Message) End Try Me.DataGrid2.DataSource = ds2.Tables(0)
I get the exception Collection was modified; enumeration operation may not execute. Any suggestions , thanks.
Jorge




Reply With Quote