trialer
Well-known member
- Joined
- Oct 4, 2010
- Messages
- 64
- Programming Experience
- 1-3
im making of a program that will move items from datagridview1 to datagridview2.
if the selected row to be move from datagridview have already in the in the datagridview2 it will do nothing
but if it doesn't have in datagridview2 it will add to its items.
here's my code but have some errors
if the selected row to be move from datagridview have already in the in the datagridview2 it will do nothing
but if it doesn't have in datagridview2 it will add to its items.
here's my code but have some errors
VB.NET:
str1 = DataGridView1.CurrentRow.Cells("Description1").Value
If DataGridView2.Rows.Count > 0 Then
With DataGridView2
For Each row As DataGridViewRow In .Rows
str2 = row.Cells("Description2").Value
If str1 = str2 Then
MsgBox(str1 + " = " + str2)
Else
MsgBox(str1 + " <> " + str2)
With DataGridView2.Rows
.Add(DataGridView1.CurrentRow.Cells("Description1").Value)
End With
End If
Next
End With
Exit Sub
ElseIf DataGridView2.Rows.Count < 1 Then
With DataGridView2.Rows
.Add(DataGridView1.CurrentRow.Cells("Description1").Value)
End With
End If
Last edited: