TextBox限制只允许输入半角数字

      Private Sub TextBox1_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles telList.KeyPress
         If (Not System.Text.RegularExpressions.Regex.IsMatch(e.KeyChar.ToString(), "[0-9]") And e.KeyChar <> " ") Then
             e.Handled = True
             Return
         End If
     End Sub

你可能感兴趣的:(TextBox限制只允许输入半角数字)