Wot is the difference between declaring a Global Variable and a Public variable?

I mean both variables can be accessed through out the project so wots the main difference apart from that Global variables cannot be declared in forms but modules only?

Recommended Answers

All 2 Replies

'Global' isn't actually a type of variable, the term is used to refer to the scope of a variable. For instance, if you declare the variable in the general section of a form ( even just using DIM ), it is 'global' to that form.
Declare it in a module and it is global to the whole project, but in this case I think you must use PUBLIC. (Any comment from other members about this?)

That's correct. Global Variables defined in a mod use the global prefix. Global Variables defined on a form use public. That is about the only difference.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.