dim a as integer
a=cint(text1.text)
运行时text1.text为空
就报错!说类型不匹配。为什么?

解决方案 »

  1.   

    if trim(text1.text)<>"" then
        a=cint(text1.text)
    end if
      

  2.   

    你可以这样写:a=cint(trim(text1.text))先把空格过滤掉阿,这样类型转换不会出问题,因为空格怎么强制转换成整型阿,^_^
      

  3.   

    你确定text1.text一定是数字吗?不是的话这样写是会引起错误的。
    dim a as integer
    if isnumeric(text1.text)=true then
        a=cint(text1.text)
    end if
      

  4.   

    dim a as integer
    a=val(text1.text)
      

  5.   

    fhr2003的方法,运行时还是错的!!
    上面的几位朋友,text1在运行的时候就是空值!不用输入值的