此主题相关图片如下:360截图1872012010011699.png
BeforeAddDataRow代码:
\'\'\'
Dim frm As WinForm.Form = Forms("行政区域库维护")
If frm.Opened = False Then
frm.open()
End If
Dim txt As String = frm.Controls("TextBox6").text
Dim txt1 As String
If txt="" Then
MessageBox.show("信息添加前需选择检索字段录入检索词确认库中无相同信息后进行,以避免重复!","提示",MessageBoxButtons.OK,MessageBoxIcon.Question)
e.Cancel = True
Else
MessageBox.show("txt:" & txt)
For Each c As WinForm.Control In frm.Controls
If Typeof c Is WinForm.RadioButton Then \'判断控件是否是单选框
Dim t As WinForm.RadioButton = c \'使用特定类型的变量引用控件
If t.checked Then
txt1= t.Text
End If
End If
Next
MessageBox.show(txt1)
Dim dr As DataRow = e.DataTable.Find("[" & txt1 & "] =\'" & txt & "\'")
If dr Is Nothing Then \'如果找到的话
e.DataRow(txt1) =txt
Else
MessageBox.Show("表中有相同的行政信息,请重新选择检索字段录入检索词并确认无相同的内容后进行,以避免重复!","提示",MessageBoxButtons.OK,MessageBoxIcon.Question)
e.cancel =True
End If
End If
前后都能通过,拉黄的有问题。