我在Delphi 6中创建了一个Application.其中只有一个Unit1单元文件
Unit 1代码如下:
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
Edit1: TEdit;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end; TStaff=class
privatepublic
name:string;
end;var
Form1: TForm1;
Staff: TStaff;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
staff.name:=edit1.Text;end;end.
但每次运行它并click button1时,delphi总会提示出错:access violation at address 0404428 in moudle ,project1 wirte of address 000000004........
为什么啊??
Unit 1代码如下:
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
Edit1: TEdit;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end; TStaff=class
privatepublic
name:string;
end;var
Form1: TForm1;
Staff: TStaff;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
staff.name:=edit1.Text;end;end.
但每次运行它并click button1时,delphi总会提示出错:access violation at address 0404428 in moudle ,project1 wirte of address 000000004........
为什么啊??
解决方案 »
- indy10中的TIdTimeUDP和TIdTimeUDPServer不能通讯
- delphi数据类型的问题
- delphi中制作的OCX在VB中调用出现问题(急急)
- cxGrid1DBTableView1怎么不响应keypress事件呀?
- dbf文件转入oracle后,中文字段变成乱码,怎样解决?在线等.
- 很菜的问题,请帮忙.谢谢!在线等!!!
- 可以使webbrowser没有立体感吗?up一下也有分!-_*
- dbcombobox的下拉列表为什么在运行以后就不出现内容了呢?
- binyao 谢谢你的控件,请进来拿分
- Delphi访问异地的Foxbase dbf文件的方法?
- 如何在自己的软件中加入注册DLL文件的功能?
- 一个关于用http应用高速下载文件的问题,up有分
staff := TStaff.Create;
staff.name:=edit1.Text;
有人说可能是因为我的机子里的病毒所致,我想不大可能吧?
begin
staff = TStaff.create(self);
staff.name:=edit1.Text;end;应该可以,还有就是最好不要把staff在那里定义,很容易出错,我也是刚刚知道。
staff = TStaff.create(self);????---create 后那有参数的啊!我用的是delphi 6
TStaff=class
private
fName:String;
public
property Name: string read fName write fName;
end;