private sub text1_change()
   if isnumeric(text1.text) then
      msgbox "是数字"
   else
      msgbox "不是数字"
   end if
end sub

解决方案 »

  1.   

    Private Sub Text1_KeyPress(KeyAscii As Integer)
        If KeyAscii > 57 Or KeyAscii < 48 Or KeyAscii = 8 Then KeyAscii = 0
    End Sub
      

  2.   

    判断输入的字符的ASCII值是否为0-9的ASCII(48--57)值即可。
      

  3.   

    If Not IsNumeric(Text1(5).Text) Then
       MsgBox ("必须为数字哦")
       Exit Sub
    End If
      

  4.   

    flag=true
    for i=1 to len(text1.text)
      if mid(text1.text,i,1)>ASC("9") or mid(text1.text,i,1)<ASC("0") then
        msgbox "有字母:" & mid(text1.text,i,1)
        flag=flase
      end if
    next i
    if flag=true then
        msgbox "只有数字。"
    end if
      

  5.   

    用isnumeric(),
    isnumeric(text1.text)=true 是数字
    否则是除数字以外的其它字符
      

  6.   

    if isnumeric(text1.text) then