Dim str As String = e.Sender.text
Dim reg As new System.Text.RegularExpressions.Regex("((\d{11})|^((\d{7,8})|(\d{4}|\d{3})-(\d{7,8})|(\d{4}|\d{3})-(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1})|(\d{7,8})-(\d{4}|\d{3}|\d{2}|\d{1}))$)")
If reg.Ismatch(str) = False Then
msgbox("号码有误")
e.cancel = True
End If
如果号码有误 If DataTables("会员资料").datarows.count = 0,,不执行下面这个代码
If DataTables("会员资料").datarows.count = 0 Then
Dim dr As Row = Tables("会员资料").addnew '加到对应表
dr("电话")=e.form.controls("TextBox1").text
dr("注册日期")=e.form.controls("TextBox2").text
dr("注册店名账号")=e.form.controls("TextBox3").text '表对应ComboBox4'
dr("注册店名")=e.form.controls("TextBox4").text '表对应ComboBox4'
End If