怎么限制EDIT只能输入0-59之间的数啊?
----------------------------------------------
Function IThink(Boy,Girl : TPerson) : String; begin if Boy.钱 < 10W then Girl.Say(''滚!'') else begin if Girl.Anser = ''我愿意'' then Result := ''结婚'' else Result := IntToStr(88); end; 风过不折→百炼成尧 QQ: 7315910
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char); begin if key=#8 then exit; if (key<#48) or (key>#57) then key:=#0; if length(edit1.Text)>1 then key:=#0; if (length(edit1.Text)=1) and (strtoint(edit1.Text)>5) then key:=#0; end;
----------------------------------------------
-
procedure TForm1.Edit1KeyPress(Sender: TObject; var Key: Char); begin if (key<'0')or(key>'9') then key:=chr(0); end; //-------------------------------------------------------------- procedure TForm1.Edit1Change(Sender: TObject); begin if edit1.Text=' then exit; if strtofloat(edit1.Text)>59 then begin showmessage('请输入小于59的数字'); edit1.Text:='; end; end; 电脑上试过,应该可以.
----------------------------------------------
注意:这个男人有点色
cyh9519 你的方法比较实用,因为我要求的是输入时就判断,请问一下你是怎么实现的呀? if (key<#48) or (key>#57) then key:=#0; 是什么意思呢?
----------------------------------------------
Function IThink(Boy,Girl : TPerson) : String; begin if Boy.钱 < 10W then Girl.Say(''滚!'') else begin if Girl.Anser = ''我愿意'' then Result := ''结婚'' else Result := IntToStr(88); end; 风过不折→百炼成尧 QQ: 7315910
cyh9519 谢谢你哈,可不可以加我QQ? 7315910
----------------------------------------------
Function IThink(Boy,Girl : TPerson) : String; begin if Boy.钱 < 10W then Girl.Say(''滚!'') else begin if Girl.Anser = ''我愿意'' then Result := ''结婚'' else Result := IntToStr(88); end; 风过不折→百炼成尧 QQ: 7315910