以文本方式查看主题 - Foxtable(狐表) (http://foxtable.net/bbs/index.asp) -- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2) ---- MAC地址递增 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=130694) |
-- 作者:huhu -- 发布时间:2019/1/29 11:43:00 -- MAC地址递增 现在有2个文本框, 起始文本框记录的是起始MAC地址9845.622f.2b00 截至文本框记录的是截至MAC地址9845.622f.2b11 如何做到在表A把这18号增加进去。我现在不知道怎么计算。 9845.622f.2b00 9845.622f.2b01 9845.622f.2b02 9845.622f.2b03 9845.622f.2b04 9845.622f.2b05 9845.622f.2b06 9845.622f.2b07 9845.622f.2b08 9845.622f.2b09 9845.622f.2b0a 9845.622f.2b0b 9845.622f.2b0c 9845.622f.2b0d 9845.622f.2b0e 9845.622f.2b0f 9845.622f.2b10 9845.622f.2b11 |
-- 作者:有点甜 -- 发布时间:2019/1/29 12:37:00 -- Dim s1 = "2b00" Dim s2 = "2b11" For i As Integer = HexToDec(s1) To HexToDec(s2) output.show(DecToHex(i)) Next |
-- 作者:huhu -- 发布时间:2019/1/29 13:33:00 -- 为什么是后四位而不是完整的mac地址? 最好是完整的mac地址,只取后四位,万一数据很大,前面的肯定会变。
|
-- 作者:有点甜 -- 发布时间:2019/1/29 15:00:00 -- Dim s1 = "9845622f2b00" Dim s2 = "9845622f2b11" For i As Decimal = HexToDec(s1) To HexToDec(s2) output.show(DecToHex(i)) Next |
-- 作者:huhu -- 发布时间:2019/1/30 10:59:00 -- 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 |
-- 作者:有点甜 -- 发布时间:2019/1/30 11:31:00 -- 用正则判断,如
Dim pattern As String = "^[0-9.a-zA-Z]{14}$" |
-- 作者:huhu -- 发布时间:2019/1/30 14:09:00 -- 帮助里面好像没搜到正则的内容。 或者你能把每个语句大概啥意思讲一下。
|
-- 作者:有点蓝 -- 发布时间:2019/1/30 17:17:00 -- https://docs.microsoft.com/zh-cn/dotnet/api/system.text.regularexpressions.regex?redirectedfrom=MSDN&view=netframework-4.7.2 |