首先选定一个datagrid中的一条记录,然后再遍历另一个datagrid中的所有记录,看看是否有相同月份和相同名称的记录,如果有则不能再添加,如果没有就可以。请问如何做?
With frmcharge_List.grddatagrid
'MsgBox .ApproxCount
For i = 0 To .ApproxCount - 1
If .RowBook(i) = aa And DataGrid1.Columns(1).Value = .RowBook(i) Then
MsgBox aa & DataGrid1.Columns(1).Value & "的记录已存在,不能再添加!", vbInformation
Exit For
End If
Next i
End With
不知道如何写?这样对吗?
With frmcharge_List.grddatagrid
'MsgBox .ApproxCount
For i = 0 To .ApproxCount - 1
If .RowBook(i) = aa And DataGrid1.Columns(1).Value = .RowBook(i) Then
MsgBox aa & DataGrid1.Columns(1).Value & "的记录已存在,不能再添加!", vbInformation
Exit For
End If
Next i
End With
不知道如何写?这样对吗?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货