参考代码
Select Case e.DataCol.name
Case "型号","规格"
Dim dr As DataRow = e.DataRow
If dr.IsNull("型号") = False AndAlso dr.IsNull("规格") = False Then
If e.DataTable.Compute("Count([_Identify])","型号 = '" & dr("型号") & "' And 规格 = '" & dr("规格") & "'") > 1 Then
MessageBox.Show("已经存在相同型号和规格的行!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
e.DataRow("c") = Nothing
Else
e.DataRow("c") = "正确"
End If
End If
End Select