procedure TForm1.Edit1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if key=13 then /*相对应的ASCII码*/ application.MessageBox('','',mb_ok); end;
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char); begin if not (key in ['0'..'9','a'..'z','A'..'Z',#8] )then key:=#0; end;
在EDIT的ON CHANGE事件中 IF NOT (KEY IN['0'..'9','a'..'z','A'..'Z',#8]) THEN KEY:=#0
在EDIT的ON CHANGE事件中 IF NOT (KEY IN['0'..'9','a'..'z','A'..'Z',#8]) THEN KEY:=#0
在EDIT的ON CHANGE事件中 IF NOT (KEY IN['0'..'9','a'..'z','A'..'Z',#8]) THEN KEY:=#0
if not (key in ['0'..'9','a'..'z','A'..'Z',#8] )then key:=#0;
在 onKeyPress事件中 只能输入数字:if not (key in ['0'..'9',#8] )then key:=#0;只能输入字母 if not (key in [,'a'..'z','A'..'Z',#8] )then key:=#0;
判断数字 if ((Key>=#48) and (Key<=#57)) or (Key='.') or (Key=#8) then TEdit(Sender).ReadOnly:=False else TEdit(Sender).ReadOnly:=True; 字母类似
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char); begin if not (key in ['0'..'9','a'..'z'] )then key:=#0; end;将[]中的字符更改成你要的就可以了
请问 if not (key in ['0'..'9','a'..'z','A'..'Z',#8] )then小数点是用#什么代表呀?
Shift: TShiftState);
begin
if key=13 then /*相对应的ASCII码*/
application.MessageBox('','',mb_ok);
end;
begin
if not (key in ['0'..'9','a'..'z','A'..'Z',#8] )then
key:=#0;
end;
IF NOT (KEY IN['0'..'9','a'..'z','A'..'Z',#8]) THEN KEY:=#0
IF NOT (KEY IN['0'..'9','a'..'z','A'..'Z',#8]) THEN KEY:=#0
IF NOT (KEY IN['0'..'9','a'..'z','A'..'Z',#8]) THEN KEY:=#0
if not (key in ['0'..'9','a'..'z','A'..'Z',#8] )then
key:=#0;
key:=#0;只能输入字母
if not (key in [,'a'..'z','A'..'Z',#8] )then
key:=#0;
if ((Key>=#48) and (Key<=#57)) or (Key='.') or (Key=#8) then
TEdit(Sender).ReadOnly:=False
else
TEdit(Sender).ReadOnly:=True;
字母类似
begin
if not (key in ['0'..'9','a'..'z'] )then
key:=#0;
end;将[]中的字符更改成你要的就可以了
if not (key in ['0'..'9','a'..'z','A'..'Z',#8] )then小数点是用#什么代表呀?