Just for clarification is there an advantage to using Private or Public as apposed to Dim for declaring variables?
By default:
a variable declared by Dim in Sub Process Globals is available to all modules.
a variable declared by Dim in Sub Globals is available only to the module in which it is declared.
A variable declared by Private in Sub Process Globals is only available to the module in which it is declared.
QUESTION 1: Is there an advantage to declare a variable using Private in Sub Process Globals over declaring the same variable using Dim in Sub Globals?
QUESTION 2: Is there a protocol to determine when and where to use these three declaration terms?
QUESTION 1: Is there an advantage to declare a variable using Private in Sub Process Globals over declaring the same variable using Dim in Sub Globals?
Thanks for the reply Erel your answer makes things a bit clearer.
My concern is that I am missing something by only using Dim.
1. I can see no reason to use either Private or Public in Sub Globals
2. I can see no reason to use Public in Sub Process Globals
3. Can you give me a practical example that would drive the use of Private in Sub Process Globals
3) AFAIK a process global variable cannot be private.
2) you dont need to. DIM is the same here as all process globals must be public/are public
1) variables marke as private in globals of main activity cannot be accessed from other activities. Public variables can.
Don't use Dim in any of the global subs. Use either public or private.
1. In Sub Globals (which is only available in Activity modules) you should only use private.
2. In other "global subs" (Process_Globals or Class_Globals) you should use private or public based on the requirements.
3. Most variables in process_globals should be private. That is unless you want to access them from a different module.
Remember that only views (and other activity objects) should be declared in Sub Globals.
The code you are refering to is in the Scale Code module.
These variables, Private cScaleX, cScaleY, cScaleDS As Double, are private to the Scale Code module accessible from any Sub in this module but no need to access them from any other module.
Don't use Dim in any of the global subs. Use either public or private.
1. In Sub Globals (which is only available in Activity modules) you should only use private.
2. In other "global subs" (Process_Globals or Class_Globals) you should use private or public based on the requirements.
3. Most variables in process_globals should be private. That is unless you want to access them from a different module.
Remember that only views (and other activity objects) should be declared in Sub Globals.