mac地址中只能出现A-F的字母,如果是其他字母就是格式不对。红色的代码怎么写?
Dim cfmac As WinForm.TextBox = e.Form.Controls("TextBox1")
Dim qsmac As WinForm.TextBox = e.Form.Controls("TextBox2")
Dim jzmac As WinForm.TextBox = e.Form.Controls("TextBox3")
Dim gsjc As WinForm.TextBox = e.Form.Controls("TextBox4")
DataTables("临时MAC").SQLDeleteFor("_identify is not null")
DataTables("临时MAC").RemoveFor("_identify is not null")
cfmac.text = ""
Dim str1 As String = qsmac.text.Replace(".","").Replace(":","").trim() ‘起始mac
Dim str2 As String = jzmac.text.Replace(".","").Replace(":","").trim() ’截至mac
Dim str12 As String
If str1.Length <> 12 or 字母只能是A-F then
XXXXX
else
Dim str As String
If gsjc.text = "" Then
str &= "公司简称不能为空,"
End If
If str1 = "" Then
str &= "起始MAC不能为空,"
End If
If str2 = "" Then
str &= "截至MAC不能为空"
End If
If str > "" Then
MessageBox.show(str.trim(","),"不能为空",MessageBoxButtons.OK,MessageBoxIcon.Error)
Else
For i As Decimal = HexToDec(str1) To HexToDec(str2)
Dim dr As DataRow = DataTables("临时MAC").AddNew
dr("mac") = DecToHex(i)
Next
DataTables("临时MAC").Save
end if
end if