If e.DataCol.Name = "样品编号" Then
Dim dr As DataRow
dr = DataTables("表A").Find("样品编号 = '" & e.NewValue & "'")
If dr IsNot Nothing Then
MessageBox.Show("样品编号禁止重复,您输入的值已经存在!")
e.Cancel = True
Else
dr = DataTables("表B").Find("样品编号 = '" & e.NewValue & "'")
If dr IsNot Nothing Then
MessageBox.Show("样品编号禁止重复,您输入的值已经存在!")
e.Cancel = True
End If
End If
End If