用验证控件控制TextArea里面只能输入数字和逗号1
发布网友
发布时间:2023-10-20 22:15
我来回答
共3个回答
热心网友
时间:2023-11-25 19:18
Imports System.Text.RegularExpressions
Public Class Form1
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
Dim re As New Regex("\d|,")
Dim text As String = e.KeyChar
Dim mc As MatchCollection = re.Matches(text)
If mc.Count = 0 Then
e.Handled = True
End If
End Sub
End Class
热心网友
时间:2023-11-25 19:18
/^(\d+\,)+\d+$/验证只能输入数字和逗号的正则
热心网友
时间:2023-11-25 19:19
var re=/[0-9,]+/