vb怎么判断是否为数字?
If IsNumeric(Text1.Text) = True Then MsgBox "纯数字"Else MsgBox "非纯数字"End If。
用 Isnumeric 来断例:点一个按钮 输入一个数字或字符来判断private sub button1_clik(byval sender as system.object.
byval eassystem.eventargs)handles button1.click.
dim x x=inputbox("请输入").if not IsNumeric(x) then.msgbox("不是数字").
elsemsgbox("是数字")。
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged.
If IsNumeric(Me.TextBox1.Text) Then.Label1.Text = "数字"。
ElseLabel1.Text = "字符"End If End Sub iif (Isnumeric("123-"),"数字","不是数字")数字?iif(val("123-")="123-","数字","不是数字")不是数字
iif(val("-123")="-123","数字","不是数字")数字看这三个判断就知道Isnumeric 是否对了!