我想让edit输入的必须是阿拉伯数字,并且回车焦点转到下一个控件,请高手教教我!(30分)

  • 主题发起人 主题发起人 wanglong1
  • 开始时间 开始时间
W

wanglong1

Unregistered / Unconfirmed
GUEST, unregistred user!
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if not (key in ['0'..'9'] or Key := #13) ;then
key:=#0;
;if (Key = #13) then
;begin
; key := #0;
; Perform(WM_NEXTDLGCTL, 0, 0);
;end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
showmessage('焦点转到了按钮上!');
end;
end.
我写的不对,请高手帮忙!
 
;if not ((key in ['0'..'9']) or (Key = #13)) ;then ;key:=#0;
; if (Key = #13) then
; begin
; ; key := #0;
; ; Perform(WM_NEXTDLGCTL, 0, 0);
; end;
 
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char);
begin
if not ((key in ['0'..'9']) or (Key := #13)) ;then
key:=#0;
;if (Key = #13) then
;begin
; key := #0;
; Perform(WM_NEXTDLGCTL, 0, 0);
;end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
showmessage('焦点转到了按钮上!');
end;
end.
 
多人接受答案了。
 
后退
顶部