我的源码在这里
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
Label1: TLabel;
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementationuses Unit2;
{$R *.dfm}
var
a:Tmember;
begin
a:=Tmember.Create;
a.Name:='zhy';
a.Age:=20;
a.Male:=false;
end; //就是这里报错
procedure TForm1.Button1Click(Sender: TObject);
begin
Label1.Caption:='afsdf';
end;end.
unit Unit1;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;type
TForm1 = class(TForm)
Label1: TLabel;
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementationuses Unit2;
{$R *.dfm}
var
a:Tmember;
begin
a:=Tmember.Create;
a.Name:='zhy';
a.Age:=20;
a.Male:=false;
end; //就是这里报错
procedure TForm1.Button1Click(Sender: TObject);
begin
Label1.Caption:='afsdf';
end;end.
解决方案 »
- 用DELPHI调用CODESOFT模板打印时,Method 'DocObjects' not supported by automation object
- 如何让DBgrid里的内容全部居中显示?
- dbgrideh怎么显示下拉列?
- 请问用adoconnection连接数据库,如何在程序运行能够动态的指定呢,谢谢了
- 各位高手:有用spcomm或mscomm开发过串行通信系统的请指教!!!!
- intraweb连接数据库的问题--来自delphi7 web 开发与应用中的例子
- 为什么我的程序被误认是木马?
- CreateProcess函数能不能,创建非可执行文件进程
- 使用int函数的问题
- 如何用Delphi制作一个Flash播放器实现写文件功能?
- 求三个sql语句的差别
- 怎么用时间控件实现按键频率
var
a:Tmember;
begin
a:=Tmember.Create;
a.Name:='zhy';
a.Age:=20;
a.Male:=false;
end; //就是这里报错
你这段是不是应该写在函数里啊?
unit Unit2;interfaceType
Tmember=class
public
Name:String;
Age:Integer;
Male:Boolean;
End;implementationend.
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Label1: TLabel;
Button1: TButton;
Button2: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
uses Unit2;
{$R *.dfm}
procedure xxxxx;
var
a:Tmember;
begin
a:=Tmember.Create;
a.Name:='zhy';
a.Age:=20;
a.Male:=false;
end; //就是这里报错
procedure TForm1.Button1Click(Sender: TObject);
begin
Label1.Caption:='afsdf';
end;
end.xxxxx处随便写点啥。。
var
a:Tmember;
begin
a:=Tmember.Create;
a.Name:='zhy';
a.Age:=20;
a.Male:=false;
end;
删除罢。。