If e.DataCol.Name = "SN" Then
Dim str As String = e.NewValue
Dim idx1 As Integer = str.IndexOf("MAC:")
Dim idx2 As Integer = str.IndexOf("H/W:")
Dim length As Integer
If str.Contains("SN:") Then
length = IIF(idx1 <> -1,idx1-3,IIF(idx2 <> -1,idx2-4,str.Length - 3))
e.NewValue = str.SubString(3, length)
End If
If str.Contains("MAC:") Then
If idx2 = -1 Then
e.DataRow("MAC") = str.SubString(idx1+4)
Else
e.DataRow("MAC") = str.SubString(idx1+4, idx2-idx1-4)
End If
End If
If str.Contains("H/W:") Then
e.DataRow("HW") = str.substring(idx2+4)
End If
End If