怎么在录入MAC地址的时候,限制格式和字符? 一直不得入门,您指点一下

如何在录入MAC地址的时候,限制格式和字符? 一直不得入门,您指点一下?我想在VB 里录入AB-33-21-00-88-12这

如何在录入MAC地址的时候,限制格式和字符? 一直不得入门,您指点一下?
我想在 VB 里录入 AB-33-21-00-88-12


  这样的 MAC 地址,


  如果 限制 录入的 字符是 16进制内的 从0-9, A-F


  而且不用 录入 中间的 -



  谢谢指点.

[解决办法]
不是很完美,先凑合用吧。

VB code
Private Sub Text1_KeyPress(KeyAscii As Integer)'AB-33-21-00-88-12    Dim L As Long    L = Text1.SelStart    If L < 18 Then        If KeyAscii = 8 Then Exit Sub        If L Mod 3 = 2 Then            If KeyAscii <> Asc("-") Then KeyAscii = 0        Else            If Not ((Asc("0") <= KeyAscii And KeyAscii <= Asc("9")) Or (Asc("A") <= KeyAscii And KeyAscii <= Asc("F")) Or (Asc("a") <= KeyAscii And KeyAscii <= Asc("f"))) Then                KeyAscii = 0            Else                KeyAscii = Asc(UCase(Chr(KeyAscii)))            End If        End If    Else        If KeyAscii <> 13 And KeyAscii <> 8 Then KeyAscii = 0    End IfEnd Sub