试试看这个
Select Case e.DataCol.Name
'判断编码和名称是否重复开始
Case "编码名称"
Dim dr As DataRow
dr = e.DataTable.Find("编码名称 = '" & e.NewValue & "'")
If dr IsNot Nothing Then
MessageBox.Show("职员名称重复是否正确!","请确认") ‘提示1
e.Cancel=True
end If
Case "编码规则"
Dim dr As DataRow
dr = e.DataTable.Find("编码规则= '" & e.NewValue & "'")
If dr IsNot Nothing Then
MessageBox.Show("职员编码重复是否正确!","请确认")
e.Cancel = True
End If
End Select