delphi中edit组件的问题
各位大侠procedureTForm1.Edit1KeyPress(Sender:TObject;varKEY:char);beginiford(key)=13theni...
各位大侠
procedure TForm1.Edit1KeyPress(Sender: TObject;var KEY :char);
begin
if ord(key)=13 then
if edit1.text<>'123456' then
begin
showmessage('帐号有错误,请重新输入');
edit1.text:='';
edit1.setfocus;
else
edit2.setfocus;
else
if (key<'0')or(key>'9')then
begin
showmessage('帐号必须有数字');
key:=#0;
end;
end;
end;
procedure TForm1.Edit2keypress(Sender: TObject;var key:char);
begin
if ord(key)=13 then
if edit2.text='Psaa' then
begin
showmessage('欢迎你');
form1.Close;
end
else
begin
showmessage('密码错误,请重新输入');
edit2.text:='';
edit2.setfocus;
end;
end;
end.
哪儿错了?
delphi 7提示第一句出错了.有劳各位了. 展开
procedure TForm1.Edit1KeyPress(Sender: TObject;var KEY :char);
begin
if ord(key)=13 then
if edit1.text<>'123456' then
begin
showmessage('帐号有错误,请重新输入');
edit1.text:='';
edit1.setfocus;
else
edit2.setfocus;
else
if (key<'0')or(key>'9')then
begin
showmessage('帐号必须有数字');
key:=#0;
end;
end;
end;
procedure TForm1.Edit2keypress(Sender: TObject;var key:char);
begin
if ord(key)=13 then
if edit2.text='Psaa' then
begin
showmessage('欢迎你');
form1.Close;
end
else
begin
showmessage('密码错误,请重新输入');
edit2.text:='';
edit2.setfocus;
end;
end;
end.
哪儿错了?
delphi 7提示第一句出错了.有劳各位了. 展开
2个回答
展开全部
"end"缺少或位置不对
if ord(key)=13 then
begin
if (trim(edit1.text)<>'123456' )then
begin
showmessage('帐号有错误,请重新输入');
edit1.text:='';
edit1.setfocus;
end
else
edit2.setfocus;
end
else
if (key<'0')or(key>'9')then
begin
showmessage('帐号必须有数字');
key:=#0;
end;
if ord(key)=13 then
begin
if (trim(edit1.text)<>'123456' )then
begin
showmessage('帐号有错误,请重新输入');
edit1.text:='';
edit1.setfocus;
end
else
edit2.setfocus;
end
else
if (key<'0')or(key>'9')then
begin
showmessage('帐号必须有数字');
key:=#0;
end;
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询