用个笨办法判断是不是超过255
Dim strIP() as string
Dim i As Integer
Dim intNum As Integer
strIP() = Split("123.234.255.345", ".") '把替换成maskedbox的内容
For i = 0 To 3
intNum = CInt(strIP(i))
If intNum > 255 Then
Debug.Print i & " " & strIP(i) & " > 255"
ElseIf intNum = 255 Then
Debug.Print i & " " & strIP(i) & " = 255"
Else
Debug.Print i & " " & strIP(i) & " < 255"
End If
Next i
加一个文本框
private sub form_load()
me.text1.text=" . . . "
me.text1.setfocucs
end sub
'每输入一个字符减少一个空格
private sub text1_change()
dim i as integer
i=instr(me.text1.text," ")
mid$(me.text1.text,i,1)=""
end sub