如何控制edit中只输入数字类型(keypress,keydown)需要例子 if key>=chr(0) and key<=chr(9) then ....else key=#0; 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);begin if (Ord(Key)<Ord('0')) or (Ord(Key)>Ord('9')) then Key:=Char(0);end; onkeypressif key in ['0'..'9'] then ...else abort 这个可能更实际一些 if key in [0..9,#8,#13] then ...else key:=#0; onkeypress //如果输入的不是数字或退格键 if (not (Key in ['0'..'9'])) and (Key <> #8) then Key := #0 经验正: gzmhero(hihihi) Focus(老鱼) bluemeteor(挂月)答案是对的给予奖励,其余人给参与分 闷热的夏天来临,散分消暑~,快来接呀~~~ dll中的函数的返回多个参数的问题. 如何释放内存? 用INDY的UDP控件发送一个RECORD类型的数据 ExpressQuantumGrid->如何根据表结构,通过程序方式动态往表中添加字段并显示对应的值,谢谢 怎么得到TListView中的HeaderCtrl 请教高手,我这个插入数据库的语句怎么结果不对?到底错在哪里? 如何在dbgrid中畫上一個對號呢﹖ table的readonly属性可以在运行时修改吗? 如何在TStringGrid中添加或删除一行? 哪里有Kylix呀? 请各位帮我除错!
begin
if (Ord(Key)<Ord('0')) or (Ord(Key)>Ord('9')) then
Key:=Char(0);
end;
if key in ['0'..'9']
then ...
else abort
...
else
key:=#0;
//如果输入的不是数字或退格键
if (not (Key in ['0'..'9'])) and (Key <> #8) then
Key := #0