D deanwj Unregistered / Unconfirmed GUEST, unregistred user! 2002-11-17 #1 请教各位大虾,怎么控制edit组件,让他只输入数字,并且数字中间不能有空格,不能有其他字符
Z zw84611 Unregistered / Unconfirmed GUEST, unregistred user! 2002-11-17 #2 在Form的Create中加一句: SetWindowLong(Edit1.Handle, GWL_STYLE,GetWindowLong(Edit1.Handle, GWL_STYLE) or ES_NUMBER);
在Form的Create中加一句: SetWindowLong(Edit1.Handle, GWL_STYLE,GetWindowLong(Edit1.Handle, GWL_STYLE) or ES_NUMBER);
H hb_wshsh Unregistered / Unconfirmed GUEST, unregistred user! 2002-11-17 #3 在OnKeyPress中: begin if (not (key in ['0'..'9','.'])) and (ord(key)<>8) then key:=#0; (ord(key)<>8) 为退格键
在OnKeyPress中: begin if (not (key in ['0'..'9','.'])) and (ord(key)<>8) then key:=#0; (ord(key)<>8) 为退格键
L linsb Unregistered / Unconfirmed GUEST, unregistred user! 2002-11-17 #4 procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char); begin if not (key in['0'..'9']) and (key <>#8) then key:=#0;//数字和退格以外的建,一律为空 end;
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char); begin if not (key in['0'..'9']) and (key <>#8) then key:=#0;//数字和退格以外的建,一律为空 end;
U ugvanxk Unregistered / Unconfirmed GUEST, unregistred user! 2002-11-17 #5 我给你一个组件吧 floatedt jsqmail@163.com
L linsb Unregistered / Unconfirmed GUEST, unregistred user! 2002-11-17 #7 如果要输入浮点数和负数: if not (key in['-','.','0'..'9']) and (key <>#8) then key:=#0;//数字和退格以外的建,一律为空