Hello!
Can anyone tell me what's the difference between Public and Global declaration of variables/constants?
I use VB for a few years, but I still don't know that...
Zvonko
Printable View
Hello!
Can anyone tell me what's the difference between Public and Global declaration of variables/constants?
I use VB for a few years, but I still don't know that...
Zvonko
Damn, I've mistyped the thread's title. It's Difference between Public and Global
Sorry, guys!
Oh Global, I think global is the same as Public, it's only in VB5/6 for backwards compitability, it was used in VB4- I think
An intrinsic object whose purpose is to collect global methods into one object.
The Global object has no syntax. You call its methods directly.
The Global object is never used directly, and cannot be created using the new operator. It is created when the scripting engine is initialized, thus making its methods and properties available immediately.
As far as their role in declaring variables, the difference between "Global" and "Public" is:
(1) "Global" only remains in the language for backward compatibility. It was used in QBasic and earlier versions of VB.
(2) "Global" can only be used in standard (.bas) modules, whereas "Public" can be used in standard modules, forms, classes, etc.
(3) In standard modules, "Global" and "Public" have the same meaning.
Thanks guys, I was just courious...
So it's the same if I declare variable as Global or as Public, although public is preferable...