如何判断输入的数据是数值型的?

解决方案 »

  1.   

    在KeyPress事件当中判断
      if Key in [0..9] then 是数值型的
    或是接受输入时整个判断,方法做个循环,类似。
      

  2.   

    try
       StrToInt();
    Except
       //Numeric Input
    End;
      

  3.   

    跟一楼一样
    if Key in [0..9] then
      

  4.   

    不行啊,出错了,incompatible type:‘char’and ‘integer’
      

  5.   

    if not KEY (in['0','1','2','3','4','5','6','7','8','9',#8]) then
    KEY := #0;