文本框只允许输入数字或 . 并且验证IP地址输入是否合法
If Not System.Text.RegularExpressions.Regex.IsMatch(Me.txtIP.Text,"^/d{1,3}/./d{1,3}$") Then
CCDC.Utility.msg.ShowWarning("服务器地址输入不正确。")
Me.txtIP.Focus()
Return False
End If
输入的是否是数字或.
Private Sub txtIP_KeyPress(ByVal sender As System.Object,ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtIP.KeyPress
e.Handled = True
If System.Text.RegularExpressions.Regex.IsMatch(e.KeyChar,"^[0-9]|/.$") OrElse (Asc(e.KeyChar) = Keys.Back) Then
e.Handled = False
End If
End Sub