我项目中的一个例子,四列都可以有几个名字,限止某员工不能在四列中重服出现,你可以参考下,
DataColChanged事件
Case "主驾", "副驾" ,"指挥","辅助"
Dim dr As DataRow = e.DataRow
Dim Str1 As String = dr("主驾") & dr("副驾") & dr("指挥") & dr("辅助")
If e.NewValue>"" Then
str1=str1.Replace(e.NewValue,"")
If Str1 > "" AndAlso Str1.Contains( e.NewValue) Then
MessageBox.Show("员工不能重复输入!","提示",MessageBoxButtons.OK,MessageBoxIcon.Error)
dr(e.DataCol.Name)=""
End If
End If