[Gambas-user] Coding problem

Benoit Minisini gambas at ...1...
Sat Apr 3 16:27:44 CEST 2004


On Saturday 03 April 2004 17:17, Fabien3D wrote:
> Le Samedi 3 Avril 2004 16:59, Fabien3D a écrit :
> > Le Samedi 3 Avril 2004 10:43, Benoit Minisini a écrit :
> > >hImage = hImage.Load("/home/fabien/Economiseur_ecran/Panoramique
> > > Uluru_1.jpg")
> > >
> > > You must learn the difference between a local variable and a global
> > > variable :-) Is it your first program ?
> >
> > Nope ! I've programmed several softwares, one of them is still sold, the
> > others are used in my job or in my video work !
> >
> > I had tried the instructions :
> > 	Global hImage as Image : doesn't work
> > I declared hImage in an Module :
> > 	Global hImage as Image
> > 		or
> > 	hImage as Image
> > 		or
> > 	Dim hImage as Image
> >
> > Don't work !
>
> I also tried the PUBLIC instruction, in the Main() and in the separate
> module. Didn't work !

You declare class/module global variables exactly like in VB: on top of the 
class/module, you write:

PUBLIC MyVariable AS DataType for a public variable.
PRIVATE MyVariable AS DataType for a private variable.

You can use the STATIC keyword in a class, if you want your variable to be 
static.

I suggest you read the language specifications on the Gambas Wiki, and the 
Differences From VB page too. You will find them useful!

Regards,

-- 
Benoit Minisini
mailto:gambas at ...1...




More information about the User mailing list