Recent

Author Topic: problem with class  (Read 3498 times)

cpalx

  • Hero Member
  • *****
  • Posts: 745
problem with class
« on: April 21, 2010, 01:50:51 am »
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

  • Hero Member
  • *****
  • Posts: 678
    • parmaja.org
Re: problem with class
« Reply #1 on: April 21, 2010, 06:00:21 am »
Did you create GV

GV := TvariableGlobales.Create;

you can put it in "initialization"
Code: [Select]
initialization
  GV := TvariableGlobales.Create;
end.

cpalx

  • Hero Member
  • *****
  • Posts: 745
Re: problem with class
« Reply #2 on: April 21, 2010, 06:06:50 pm »
Thanks

 

TinyPortal © 2005-2018