delphi高手帮忙看看,窗口调用问题

来源:百度知道 编辑:UC知道 时间:2024/05/16 14:14:56
刚学用delphi,做了一个主窗口,上面有一个按钮调用另外一个窗口,结果老是报这个错.这是什么错误?用的是delphi2005

project encountered unhandled exception class System.NullReeferenceException with message 'Object reference not set to an instance of an object'

以下是程序
unit loginUnit;

interface

uses
System.Drawing, System.Collections, System.ComponentModel,
System.Windows.Forms, System.Data;

type
TWinForm = class(System.Windows.Forms.Form)
{$REGION 'Designer Managed Code'}
strict private
/// <summary>
/// Required designer variable.
/// </summary>
Components: System.ComponentModel.Container;
Label1: System.Windows.Forms.Label;
Label2: System.Windows.Forms.Label;
Button1: System.Windows.Forms.Button;
Button2: System.Windows.Forms.Button;
TextBox1: System.Windows.Forms.TextBox;
TextBox2: System.Windows.Forms.TextBox;
/// &l

procedure TwinFormMain.MenuItem5_Click(sender: System.Object; e: System.EventArgs);
begin

f_login.show;

end;
-------------------------------------------------
这里改成
f_login:=Tf_login.create(application);
f_login.showmodal;
f_login.free;

在uses语句中加入被调用的单元.