Forum > General

problem with class

(1/1)

cpalx:
hello,

why this clas compile but i can not use it???

i call from other unit, i add in clausules uses

and in a button just put this

GV.sgEnterpriseName:=''

and crash

the class is :



unit STglobalVariables;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils;

Type

  { TBD }
  TvariableGlobales = class

  private
  public
  sgEnterpriseName,
    sgHostBD, sgNameBD,
    sgUserBD, sgpasswdBD,
    sgPortBD, sgProtocolBD,
    sgSecurityConecctionDB,
    sgVersionApp, sgVersionBD: String;
    procedure AsignaValoresPorDefecto();
end;
var  GV: TvariableGlobales;


implementation
{ TBD }

procedure TvariableGlobales.AsignaValoresPorDefecto();
begin
 sgEnterpriseName:='STsoft';
end;

end.

Zaher:
Did you create GV

GV := TvariableGlobales.Create;

you can put it in "initialization"

--- Code: ---initialization
  GV := TvariableGlobales.Create;
end.

--- End code ---

cpalx:
Thanks

Navigation

[0] Message Index

Go to full version