DataColChanging事件
If e.DataCol.Name = "B列" AndAlso e.newvalue <> Nothing Then Dim fdr As DataRow = e.DataTable.Find("A列 = '" & e.newValue & "'") If fdr IsNot Nothing Then msgbox("不能重复") e.cancel = True End IfEnd If