[Gambas-user] global variable
Fabien Bodard
abidoo.too at ...11...
Sat Jun 5 20:42:22 CEST 2004
Le jeudi 3 Juin 2004 13:51, Grahame White a écrit :
> On Thursday 03 June 2004 12:28, Tim Hanschen wrote:
> > Hi,
> >
> > I need a global variable which is "shared" between some forms... how can
> > I do it. I tried to pass a variable via _new, but it is too
> > complicated...
> >
> > Is there a possibility to define a variable that can be accessed in all
> > forms?
> >
> > regards,
> > - Tim -
>
> FFoo.class
>
> PUBLIC SUB Button1_Click()
>
> PRINT CBaz.bar
>
> END SUB
>
>
>
>
> CBaz.class
>
> PUBLIC bar as Integer
>
> PUBLIC SUB _init()
>
> bar = 10
> END SUB
>
>
>
> Basically if you create a public variable in one file you can reference
> that variable by explicitly stating which file the variable is in
>
> Grahame
>
>
But i think that you need to check the public form option in project option...
An other way is to create a module like in vb :
*********MyModule.module*********************
PUBLIC bar as Integer
*************FMyForm.class*******************************
Public Sub Button_Click()
Message.Info(MyModule.bar)
END
More information about the User
mailing list