我想在用户输入用户名和密码正确之后,弹出Menu的窗体,但是系统却提示Menu.show出错,代码摘如下:
unit login;interfaceuses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, DB, ADODB;type
  TForm1 = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    user: TEdit;
    pass: TEdit;
    Cancel: TButton;
    login: TButton;
    procedure CancelClick(Sender: TObject);
    procedure loginClick(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;var
  Form1: TForm1;implementationuses menu;{$R *.dfm}procedure TForm1.CancelClick(Sender: TObject);
begin
  Application.Terminate;
end;
procedure TForm1.loginClick(Sender: TObject);
begin
  if (user.Text<>'admin') or (pass.Text<>'yingmingtan') then
    begin
      ShowMessage('Username or Password is error! Please Connact to Manager!');
      user.Text := '';
      pass.Text := '';
    end
  else
    begin
      Self.Close;
      menu.show;//此行报错:[Error] login.pas(47): Undeclared identifier: 'show' 
    end;
end;end.

解决方案 »

  1.   

    if menu= nil then
         begin
              Application.CreateForm(Tmenu, menu);
              menu.show;
         end
         else
              menu.show;
      

  2.   

    else
        begin
          Self.Close;
          将(menu.show;)换成     
         if menu= nil then
         begin
              Application.CreateForm(Tmenu, menu);
              menu.show;
         end
         else
              menu.show;     试试行不?
        end;
      

  3.   

    我觉得还是想让(user.Text='admin') or (pass.Text='yingmingtan') then
        begin
    ……这样做好些。
      

  4.   

    你的menu 的form的名称.show
    而非 menu.show
      

  5.   

    你的意思是什么?
    menu是主窗口吗
    那样的话你可以在menu中的onshow设置
    procedure Tmain.FormShow(Sender: TObject);
    begin
    login.showmodal; //弹出登陆窗口
    end;
    在登陆窗口中在设置一下就行了
      

  6.   

    else
        begin
          Self.Close;
          menu.show;//此行报错:[Error] login.pas(47): Undeclared identifier: 'show' 
        end呵呵,楼主,你的程序中,哪个窗体是主窗体呢 ?
    如果是登陆窗体,那就Self.Close 改为:self.hide;menu.show;
    menu 是窗体名称还是……?
      

  7.   

    我给你一个建议:
         AMenu:=TMenuForm.Create(Application);
         try
           AMenu.ShowModal;
         finally
           AMenu.Free;