请教,代码中少了什么呢?(50分)

  • 主题发起人 主题发起人 yedixifeng
  • 开始时间 开始时间
Y

yedixifeng

Unregistered / Unconfirmed
GUEST, unregistred user!
unit FLogon;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, SUIButton, StdCtrls, SUIEdit, ExtCtrls, SUIForm, DB, ADODB,
SUIComboBox;

type
TFrmLogon = class(TForm)
suiForm1: TsuiForm;
Label1: TLabel;
Label2: TLabel;
ed2: TsuiEdit;
bt1: TsuiButton;
suiButton2: TsuiButton;
qy: TADOQuery;
cb: TsuiComboBox;
procedure suiButton2Click(Sender: TObject);
procedure bt1Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure FormKeyPress(Sender: TObject; var Key: Char);
private
{ Private declarations }
public
{ Public declarations }
end;

var
FrmLogon: TFrmLogon;

implementation

uses DataModule, PublicFunc, Main;

{$R *.dfm}

procedure TFrmLogon.suiButton2Click(Sender: TObject);
begin
Application.Terminate;
end;

procedure TFrmLogon.bt1Click(Sender: TObject);
begin
with qy do
begin
Close;
Connection := DataModule.DM.adoc;
sql.Clear;
sql.Add('Select * from operator where name=' + '''' + cb.Text + '''');
open;
if (RecordCount = 0) then
begin
Frm_MsgBox{注:运行时光标停在这里}('系统信息', '此用户名不存在!', MsgBox_OK_INFO);
Exit;
end
else if ed2.Text <> trim(FieldByName('password').AsString) then
begin
Frm_MsgBox('系统信息', '密码不正确,请重新输入!', MsgBox_OK_INFO);
ed2.Clear;
ed2.SetFocus;
Exit;
end;
G_iOperator := FieldByName('id').AsInteger;
DM.UserID := FieldByName('id').AsInteger;
DM.UserName := FieldByName('name').AsString;
DM.UserPassword := FieldByName('password').AsString;
end;
Log('登录', true);
Close;
end;

procedure TFrmLogon.FormShow(Sender: TObject);
var
i: integer;
begin
with qy do
begin
Close;
Connection := DM.adoc;
sql.Clear;
sql.Add('Select * from operator');
open;
First;
cb.Clear;
for i := 0 to RecordCount - 1 do
begin
cb.Items.Add(FieldByName('name').AsString);
next;
end;
if (RecordCount > 0) then cb.ItemIndex := 0;
end;
end;

procedure TFrmLogon.FormKeyPress(Sender: TObject; var Key: Char);
begin
if (Key = #13) then bt1Click(Sender);
;
end;

end.
以上是代码。
1、Frm_MsgBox{注:运行时光标停在这里}
2、下方提示Undeclared indentifier

请教,代码中少了什么呢?
 
再明显不过,少了 Frm_MsgBox
 
很明显嘛!Frm_MsgBox 未定义。
检查一下 DataModule, PublicFunc, Main 这三个单元有没有定义 Frm_MsgBox。
 
多人接受答案了。
 
后退
顶部