مرحبا
ممكن احد يعدل لي ع هذا الكود الفكره اذاكانت البيانات في DataGridView1 = DataGridView2 يظهر لي اوك بس هنا المشكله ع طول يظهر لي كلمة ok
المشكله الثانية لا ينقل لي البيانات المختلفة لDataGridView3 ينقل لي البيانات المتشابه بس ويكررها
ممكن احد يعدل لي ع هذا الكود الفكره اذاكانت البيانات في DataGridView1 = DataGridView2 يظهر لي اوك بس هنا المشكله ع طول يظهر لي كلمة ok
المشكله الثانية لا ينقل لي البيانات المختلفة لDataGridView3 ينقل لي البيانات المتشابه بس ويكررها
كود :
For Each r1 As DataGridViewRow In DataGridView1.Rows
For Each r2 As DataGridViewRow In DataGridView2.Rows
If r1.Cells(0).Value = r2.Cells(0).Value Then
MsgBox("ok")
For indx As Integer = 2 To 5
Dim val1 As Double = r1.Cells(indx).Value
Dim val2 As Double = r2.Cells(indx).Value
If r1.Cells(0).Value <> r2.Cells(0).Value Then
Form3.DataGridView3.Rows.Add(r1.Cells(0).Value, r1.Cells(1).Value,
r1.Cells(2).Value, r1.Cells(3).Value, r1.Cells(4).Value, r1.Cells(5).Value)
Else
Form3.DataGridView3.Rows.Add(r2.Cells(0).Value, r2.Cells(1).Value, r2.Cells(2).Value, r2.Cells(3).Value,
r2.Cells(4).Value, r2.Cells(5).Value)
Form3.Show()
For i = 0 To Form3.DataGridView3.Rows.Count - 2
For j = Form3.DataGridView3.Rows.Count - 1 To i + 1 Step -1
If Form3.DataGridView3.Rows(i).ToString = Form3.DataGridView3.Rows(j).ToString Then
Form3.DataGridView3.Rows.RemoveAt(j)