使用maskedit其editmask设置为99999;1;_    //6位以下的数字

解决方案 »

  1.   

    1、用TMaskEdit代替TEdit;
    2、TEdit的OnKeyPress事件代码:
      if not (key in ['0'..'9',#13,#8]) then key := #0;
      

  2.   

    edit.keypress 事件里
    if key in ['0'..'9'] then //再del等控制健加井来
        ......
    else
      key:=#0;
      

  3.   

    请问:空格,DEL,回车的ASIC键时多少呢?
      

  4.   

    同意   newyj(老鬼)
    To yangxb(云中漫步):查字符的Ascii:在Edit1.KeyPress中
    edit1.text:=Ord(Chr(Key));
      

  5.   

    查字符的ASCII?  
    在  Edit1.KeyPress中 showmessage(kye);即可
     
      

  6.   

    你按哪个键就是哪个键的ASCII
    空格=32
    DEL=7
    回车=13
      

  7.   

    错了。应该是:showmessage(inttostr(ord(kye)));
      

  8.   

    在keypress 中设置
        if not (key in ['0'..'9]) then
          key:=#0
     搞定!