这是我从一本书上抄的程序,为什么我和书上的一样会没法运行呢? unit log;
interface
uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls,guessfm;
type Tlogform = class(TForm) Edtusername: TEdit; user: TLabel; password: TLabel; Edtpassword: TEdit; Btnok: TButton; procedure BtnokClick(Sender: TObject); private { Private declarations } public { Public declarations } end;
var logform: Tlogform;
implementation
{$R *.dfm}
procedure Tlogform.BtnokClick(Sender: TObject); const username:string=''; password:string=''; begin if not(Edtusername.Text=username)then begin showmessage('输入的用户名错误,请重新输入!'); Edtusername.Text:=''; Edtusername.SetFocus; end else if not(Edtpassword.Text=password)then begin showmessage('输入的密码错误,请重新输入!'); Edtpassword.Text:=''; Edtpassword.SetFocus; end else begin guessfm.Show; log.Hide; end; end;
end.