delphi7用户登陆窗体错误怎么解决
请高手看看我这段代码都错在什么地方,好多错误啊,帮我改改,谢谢。procedureTform1.formcreate(sender:Tobject);beginform1...
请高手看看我这段代码都错在什么地方,好多错误啊,帮我改改,谢谢。
procedure Tform1.formcreate(sender: Tobject);
begin
form10.showmodal;{在主窗体建立前先出现登录窗体}
end;
procedure Tform10.Button1Click(Sender: TObject);
begin{这个地方就简单点写了,说明问题就行了}
if (combobox1.text='aa') and (combobox2.text='123') then
form10.hide{如果输入正确,登录窗体hide,主窗体出现}
else
begin
showmessage('密码或用户名不正确');
combobox1.clear;
combobox2.clear;
combobox1.setfocus;
end;
end;
procedure Tform10.button2click(sender: tobject);
begin
form10.close;{如果取消,先关闭登录窗体,再关闭主窗体}
form1.close;
end;
构建
[错误] Unit1.pas(27): Statement expected but 'PROCEDURE' found[错误] Unit1.pas(28): Identifier redeclared: 'TForm1.FormCreate'
[错误] Unit1.pas(29): Undeclared identifier: 'form10'[错误] Unit1.pas(30): Missing operator or semicolon
[错误] Unit1.pas(31): Statement expected but '..' found[错误] Unit1.pas(34): ';' expected but '.' found
[错误] Unit1.pas(36): Undeclared identifier: 'combobox1'[错误] Unit1.pas(37): Undeclared identifier: 'form10'
[错误] Unit1.pas(37): '(' expected but ';' found[错误] Unit1.pas(38): Missing operator or semicolon
[错误] Unit1.pas(42): Missing operator or semicolon[错误] Unit1.pas(43): Undeclared identifier: 'combobox2'
[错误] Unit1.pas(44): Missing operator or semicolon[错误] Unit1.pas(48): Identifier redeclared: 'Tform10'
[错误] Unit1.pas(50): Undeclared identifier: 'form10'[错误] Unit1.pas(50): '(' expected but ';' found
[错误] Unit1.pas(53): '.' expected but ';' found[致命错误] Project1.dpr(7): Could not compile used unit 'Unit1.pas' 展开
procedure Tform1.formcreate(sender: Tobject);
begin
form10.showmodal;{在主窗体建立前先出现登录窗体}
end;
procedure Tform10.Button1Click(Sender: TObject);
begin{这个地方就简单点写了,说明问题就行了}
if (combobox1.text='aa') and (combobox2.text='123') then
form10.hide{如果输入正确,登录窗体hide,主窗体出现}
else
begin
showmessage('密码或用户名不正确');
combobox1.clear;
combobox2.clear;
combobox1.setfocus;
end;
end;
procedure Tform10.button2click(sender: tobject);
begin
form10.close;{如果取消,先关闭登录窗体,再关闭主窗体}
form1.close;
end;
构建
[错误] Unit1.pas(27): Statement expected but 'PROCEDURE' found[错误] Unit1.pas(28): Identifier redeclared: 'TForm1.FormCreate'
[错误] Unit1.pas(29): Undeclared identifier: 'form10'[错误] Unit1.pas(30): Missing operator or semicolon
[错误] Unit1.pas(31): Statement expected but '..' found[错误] Unit1.pas(34): ';' expected but '.' found
[错误] Unit1.pas(36): Undeclared identifier: 'combobox1'[错误] Unit1.pas(37): Undeclared identifier: 'form10'
[错误] Unit1.pas(37): '(' expected but ';' found[错误] Unit1.pas(38): Missing operator or semicolon
[错误] Unit1.pas(42): Missing operator or semicolon[错误] Unit1.pas(43): Undeclared identifier: 'combobox2'
[错误] Unit1.pas(44): Missing operator or semicolon[错误] Unit1.pas(48): Identifier redeclared: 'Tform10'
[错误] Unit1.pas(50): Undeclared identifier: 'form10'[错误] Unit1.pas(50): '(' expected but ';' found
[错误] Unit1.pas(53): '.' expected but ';' found[致命错误] Project1.dpr(7): Could not compile used unit 'Unit1.pas' 展开
展开全部
不用form10.hide,窗口不关掉,主窗口是不能接受键盘鼠标操作的。可以设置窗口的ModalResult属性表示是否登录成功,ShowModal之后判断。
procedure Tform1.formcreate(sender: Tobject);
begin
form10.ModalResult := 0;
form10.showmodal;{在主窗体建立前先出现登录窗体}
if form1.ModalResult = 1 then ...
end;
procedure Tform10.Button1Click(Sender: TObject);
begin{这个地方就简单点写了,说明问题就行了}
if (combobox1.text='aa') and (combobox2.text='123') then begin
form10.close;
form10.ModalResult := 1;
end else
begin
showmessage('密码或用户名不正确');
combobox1.clear;
combobox2.clear;
combobox1.setfocus;
end;
end;
procedure Tform10.button2click(sender: tobject);
begin
form10.close;{如果取消,先关闭登录窗体,再关闭主窗体}
form1.close;
end;
procedure Tform1.formcreate(sender: Tobject);
begin
form10.ModalResult := 0;
form10.showmodal;{在主窗体建立前先出现登录窗体}
if form1.ModalResult = 1 then ...
end;
procedure Tform10.Button1Click(Sender: TObject);
begin{这个地方就简单点写了,说明问题就行了}
if (combobox1.text='aa') and (combobox2.text='123') then begin
form10.close;
form10.ModalResult := 1;
end else
begin
showmessage('密码或用户名不正确');
combobox1.clear;
combobox2.clear;
combobox1.setfocus;
end;
end;
procedure Tform10.button2click(sender: tobject);
begin
form10.close;{如果取消,先关闭登录窗体,再关闭主窗体}
form1.close;
end;
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询