有专门的函数:isnumeric()
例如:
Private Sub Command1_Click()
If Not IsNumeric(Text1.Text) Then
mshbox "不是数字!"
End If
End Sub
直接用IsNumeric(Text1.tex1)啊,true则为数字,false则非数字 !!
dim s as string,s1 as string
s1=text1.text
for i=1 to len(s1)
s=mid(s1,i,1)
select case s
case "0" t0 "9"
case else
mgsbox "不是数字"
exit for
end select
next