主题:跪求各位大虾解答 关于单元引用
[em7]我主要想试验在第2单元中使用主单元的组件,下面是主要代码:
unti1
uses unit2...
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
e:string;
v:string;
begin
e:=edit1.Text;
hh.lll(e,v);
edit1.Text:=v;
end;
end.
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,StdCtrls;
type
tttt=class
public
Label2: TLabel;
procedure lll(s:string;var r:string);
end;
implementation
procedure tttt.lll(s:string;var r:string);
begin
r:='tttt';
label2.Caption:='ttttt';
end;
end.
编译能通过 但在运行程序时出错,跳出:存取地址出错之类的话,跪求解答,先谢谢拉
unti1
uses unit2...
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var
e:string;
v:string;
begin
e:=edit1.Text;
hh.lll(e,v);
edit1.Text:=v;
end;
end.
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,StdCtrls;
type
tttt=class
public
Label2: TLabel;
procedure lll(s:string;var r:string);
end;
implementation
procedure tttt.lll(s:string;var r:string);
begin
r:='tttt';
label2.Caption:='ttttt';
end;
end.
编译能通过 但在运行程序时出错,跳出:存取地址出错之类的话,跪求解答,先谢谢拉