[Gambas-user] global variable

Trorrr [Hÿffffe9ctor Fernÿffffe1ndez] trorrr at ...397...
Thu Jun 3 16:55:46 CEST 2004


 --- Grahame White <grahame at ...457...>
escribió: > 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 -

You can create a module (e.g: GlobalVars) which
contains public variables.  You should declare them
as:

public SomeThing as integer (if it is an integer)

Then, when you want to access the variable, you should
use:

GlobalVars.Something = Whateveryouwant

Hope it hepls you
> 
> 
> 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
> 
> 
>
-------------------------------------------------------
> This SF.Net email is sponsored by the new
> InstallShield X.
> From Windows to Linux, servers to mobile,
> InstallShield X is the one
> installation-authoring solution that does it all.
> Learn more and
> evaluate today!
> http://www.installshield.com/Dev2Dev/0504
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
>
https://lists.sourceforge.net/lists/listinfo/gambas-user 


		
______________________________________________________________________
Correo Yahoo! - 6MB, más protección contra el spam ¡Gratis!
http://correo.yahoo.es




More information about the User mailing list