以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  DataColChanging  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=115962)

--  作者:huhu
--  发布时间:2018/3/17 13:53:00
--  DataColChanging

DataColChanging

If e.DataCol.Name = "MAC" Then
    Dim str As String = e.NewValue.Replace(chr(10), "").Replace(chr(13), "")
    msgbox(str)
    Dim idx As Integer = str.IndexOf("MAC:")
    str = str.SubString(idx + 4)
    msgbox(str)
    str = str.Replace(":","")
    msgbox(str)
    e.DataRow("MAC") = str
End If

msbox一直反复循环好几次。这是怎么回事?
输入的内容是SN:123 MAC:8479:7318:8a97
[此贴子已经被作者于2018/3/17 13:53:15编辑过]

--  作者:有点蓝
--  发布时间:2018/3/17 14:18:00
--  
If e.DataCol.Name = "MAC" Then
    Dim str() As String = e.NewValue.Replace(chr(10), "").Replace(chr(13), "").Replace("MAC:", "$").split("$")
    If str.Length = 2
        e.NewValue = str(1)
    End If
End If