delphi 里我建了一个mainmenu菜单,我想点一下mainmenu上自己设置的一个键连接form2
unitUnit1;interfaceusesWindows,Messages,SysUtils,Variants,Classes,Graphics,Controls,F...
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus;
type
TForm1 = class(TForm)
MainMenu1: TMainMenu;
N1: TMenuItem;
N2: TMenuItem;
N3: TMenuItem;
N4: TMenuItem;
N5: TMenuItem;
N6: TMenuItem;
N7: TMenuItem;
N8: TMenuItem;
N9: TMenuItem;
N10: TMenuItem;
N11: TMenuItem;
N12: TMenuItem;
N13: TMenuItem;
N14: TMenuItem;
N15: TMenuItem;
N16: TMenuItem;
N17: TMenuItem;
procedure N1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var Form1: TForm1;
implementation uses unit2;
{$R *.dfm}
procedure TForm1.N1Click(Sender: TObject);
begin
form2:=TForm2.Create(nil);
Form2.Show;
end;
end.
在运行时提示project1.exe raised exception class elisterror with message 'list index out of bounds(0)',这是为什么?麻烦大虾们帮帮忙,谢谢 展开
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus;
type
TForm1 = class(TForm)
MainMenu1: TMainMenu;
N1: TMenuItem;
N2: TMenuItem;
N3: TMenuItem;
N4: TMenuItem;
N5: TMenuItem;
N6: TMenuItem;
N7: TMenuItem;
N8: TMenuItem;
N9: TMenuItem;
N10: TMenuItem;
N11: TMenuItem;
N12: TMenuItem;
N13: TMenuItem;
N14: TMenuItem;
N15: TMenuItem;
N16: TMenuItem;
N17: TMenuItem;
procedure N1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var Form1: TForm1;
implementation uses unit2;
{$R *.dfm}
procedure TForm1.N1Click(Sender: TObject);
begin
form2:=TForm2.Create(nil);
Form2.Show;
end;
end.
在运行时提示project1.exe raised exception class elisterror with message 'list index out of bounds(0)',这是为什么?麻烦大虾们帮帮忙,谢谢 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询