谢谢

解决方案 »

  1.   

    用Val转换一下,如果不能转换就说明不是数字。
    看看Val的帮助吧
    =========================
    欢迎使用 CSDN 论坛助手  .....   [助您多、快、好、爽地上csdn...]
    Http://www.ChinaOK.net/csdn/【地址无效】
    最后更新2004年7月11日
      

  2.   

    用TryStrToInt函数。返回true就是全数字,返回false则有其他字符。
      

  3.   

    Val不是用异常的,它本省就可以返回一个标识。
    看看帮助啊。俺也记不清了。
    ==========================================
    欢迎使用 Forums Helper 论坛助手... [助您多、快、好、爽上CSDN...]
    程序最后更新2004年7月11日          [Powered By ChinaOK]
      

  4.   

    在keypress中判断
    procedure TfrmAddMoney.edtMoneyKeyPress(Sender: TObject; var Key: Char);
    //const
      //dot : PChar='.';
    //var
      //str : PChar ;
      //len : Integer;
    begin
      //str := PChar(edtMoney.Text );
      //len := StrLen(str);
      //if  (strLComp(dot,str,1)=0) then
        // ShowMessage('首尾字符不能是‘.’');
      if Pos(Key,'1234567890.') = 0 then begin
        Key := Chr(0);
        ShowMessage('不能输入非数字的字符!');
      end;
    end;
      

  5.   

    if not (key in ['0'..'9','.']) then key := #0;
      

  6.   

    procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
    begin  if key in ['1','2','3','4','5','6','7','8','9','0','.',#8] then
      begin
      end else
      begin
        if key=#13 then  Edit1.SetFocus else
        key:=#0; //过滤掉其他的输入
      end
    end;