If e.DataCol.name = "姓名" Then
Dim fdr As DataRow = DataTables("目录").Find("姓名 = '" & e.newValue & "'")
If fdr Is Nothing Then
MessageBox.Show("姓名输入错误","提示")
e.DataRow.SetError("姓名", "姓名输入错误")
Else
e.DataRow.SetError("姓名", "")
'e.cancel = True
End If
End If
If e.DataCol.name = "罚款人1" Then
Dim fdr As DataRow = DataTables("目录").Find("姓名 = '" & e.newValue & "'")
If fdr Is Nothing Then
MessageBox.Show("姓名输入错误","提示")
e.DataRow.SetError("罚款人1", "姓名输入错误")
Else
e.DataRow.SetError("罚款人1", "")
'e.cancel = True
End If
End If
If e.DataCol.name = "罚款人2" Then
Dim fdr As DataRow = DataTables("目录").Find("姓名 = '" & e.newValue & "'")
If fdr Is Nothing Then
MessageBox.Show("姓名输入错误","提示")
e.DataRow.SetError("罚款人2", "姓名输入错误")
Else
e.DataRow.SetError("罚款人2", "")
'e.cancel = True
End If
End If
If e.DataCol.name = "罚款人3" Then
Dim fdr As DataRow = DataTables("目录").Find("姓名 = '" & e.newValue & "'")
If fdr Is Nothing Then
MessageBox.Show("姓名输入错误","提示")
e.DataRow.SetError("罚款人3", "姓名输入错误")
Else
e.DataRow.SetError("罚款人3", "")
'e.cancel = True
End If
End If
If e.DataCol.name = "罚款人4" Then
Dim fdr As DataRow = DataTables("目录").Find("姓名 = '" & e.newValue & "'")
If fdr Is Nothing Then
MessageBox.Show("姓名输入错误","提示")
e.DataRow.SetError("罚款人4", "姓名输入错误")
Else
e.DataRow.SetError("罚款人4", "")
'e.cancel = True
End If
End If
怎么样简化写