J
JUMP1972
Unregistered / Unconfirmed
GUEST, unregistred user!
我声明了一个单元文件如下(保存当前登录用户的信息,以备别处使用):
unit U_common;
interface
uses
Classes;
type
TU_Common=class(TObject)
private
FCur_OptNum,FCur_OptName:String;
procedure SetCur_OptNum(aOptNum:String);
procedure SetCur_OptName(aOptName:String);
public
// constructor Create;
published
property Cur_OptNum:String read FCur_OptNum write SetCur_OptNum;
property Cur_OptName:String read FCur_OptName write SetCur_OptName;
end;
var
Common:TU_Common;
implementation
{constructor TU_Common.Create;
begin
inherited Create;
FCur_OptNum:=#0;
FCur_OptName:=#0;
end;}
procedure TU_Common.SetCur_OptNum(aOptNum:String);
begin
FCur_OptNum:=aOptNum;
end;
procedure TU_Common.SetCur_OptName(aOptName:String);
begin
FCur_OptName:=aOptName;
end;
end.
我在别的单元中如下调用的:
Common.Cur_OptNum:=CmbBoxNum.Text;
Common.Cur_OptName:=EdtName.Text;
但每次运行总是出错!
unit U_common;
interface
uses
Classes;
type
TU_Common=class(TObject)
private
FCur_OptNum,FCur_OptName:String;
procedure SetCur_OptNum(aOptNum:String);
procedure SetCur_OptName(aOptName:String);
public
// constructor Create;
published
property Cur_OptNum:String read FCur_OptNum write SetCur_OptNum;
property Cur_OptName:String read FCur_OptName write SetCur_OptName;
end;
var
Common:TU_Common;
implementation
{constructor TU_Common.Create;
begin
inherited Create;
FCur_OptNum:=#0;
FCur_OptName:=#0;
end;}
procedure TU_Common.SetCur_OptNum(aOptNum:String);
begin
FCur_OptNum:=aOptNum;
end;
procedure TU_Common.SetCur_OptName(aOptName:String);
begin
FCur_OptName:=aOptName;
end;
end.
我在别的单元中如下调用的:
Common.Cur_OptNum:=CmbBoxNum.Text;
Common.Cur_OptName:=EdtName.Text;
但每次运行总是出错!