Z
zl2826
Unregistered / Unconfirmed
GUEST, unregistred user!
很菜的问题,业余学习书本范例,出错代码如下//???处,请指教!unit Unit100;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Buttons, ExtCtrls,Unit102,Unit103;
type
TForm1 = class(TForm)
CheckBox1: TCheckBox;
Panel1: TPanel;
Label1: TLabel;
Edit1: TEdit;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.BitBtn1Click(Sender: TObject);
var
pwdfile:textfile;
pwdstr:string;
times:integer;
begin
if checkbox1.Checked=true then
assignfile(pwdfile,'c:/work/管理员.cfg')
else
assignfile(pwdfile,'c:/work/学生.cfg');
reset(pwdfile); //?????
readln(pwdfile,pwdstr);
closefile(pwdfile);
times:= times+1;
if edit1.Text=pwdstr then
begin
if checkbox1.Checked=true then form2.show
else form3.show;
end
else
begin
if MessageDlg('密码输入错误。是否退出?',mtConfirMation,[mbYes,mbNo],0)=mrYes then Close
else if times<3 then edit1.SetFocus
else
begin
MessageDlg('对不起,密码输入严重错误!请退出。',mtInformation,[mbOk],0);
Application.Terminate;
end;
end;
end;
end.
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Buttons, ExtCtrls,Unit102,Unit103;
type
TForm1 = class(TForm)
CheckBox1: TCheckBox;
Panel1: TPanel;
Label1: TLabel;
Edit1: TEdit;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.BitBtn1Click(Sender: TObject);
var
pwdfile:textfile;
pwdstr:string;
times:integer;
begin
if checkbox1.Checked=true then
assignfile(pwdfile,'c:/work/管理员.cfg')
else
assignfile(pwdfile,'c:/work/学生.cfg');
reset(pwdfile); //?????
readln(pwdfile,pwdstr);
closefile(pwdfile);
times:= times+1;
if edit1.Text=pwdstr then
begin
if checkbox1.Checked=true then form2.show
else form3.show;
end
else
begin
if MessageDlg('密码输入错误。是否退出?',mtConfirMation,[mbYes,mbNo],0)=mrYes then Close
else if times<3 then edit1.SetFocus
else
begin
MessageDlg('对不起,密码输入严重错误!请退出。',mtInformation,[mbOk],0);
Application.Terminate;
end;
end;
end;
end.