Checking for numeric value entered in text box in Visual Basic

前端 未结 6 1303
醉酒成梦
醉酒成梦 2021-01-18 19:21

I am working on a program for my Visual Basic class and have a quick question. One of the things we were encouraged to do was to check to make sure the quantity entered in a

6条回答
  •  悲哀的现实
    2021-01-18 19:42

    Use Regex.IsMatch:

    Public Function isNumeric(input As String) As Boolean
        Return Regex.IsMatch(input.Trim, "\A-{0,1}[0-9.]*\Z")
    End Function
    

提交回复
热议问题