The main reason for this is that I've run into inconsistent behavior in my app.
My opinion on Scope. Plz argue your opinion.
Scope, or "the lifetime of variables, constants, subs, functions and UDT's (User Defined Types)".
Global.QObject:
Public Dim
Public Const
Public Sub
Public Function
Public UDT variable
For Application-wide access by Name.
Any Module (not sure about Forms...):
Global Sub
Global Function
Access from anywhere by Name
IMO. (I have to think/test a little more on Global Dim, Global Const and Global UDT variables. Their natural 'home' should be in Global.QObject as Public. But again for readability...)
The only difference btw Global Sub/Function and Public Sub/Function is that Global is accessable by Name from anywhere, just as if declared Public in Global.QObject.
The reason I once requested it is code readability. Keeping Subs/Functions called from more than one Form/Module easily accessible in one place (Module).
Any Form/Module:
Public Dim
Public Const
Public Sub
Public Function
Public UDT variable
Access by Name within the same Form/Module
Access from anywhere by Form/Module-name.Name
Dim
Const
Sub
Function
UDT variable
Access only within same Form/Module by Name
IMO Global or Public inside Subs/Functions shoul generate a compiler error.
Why I say UDT variable:
I never use, or have seen, except in very simple apps Public Type MyType.
I use them in Global.QObject as:
Type MyType
ID As Integer
Name As String
Address As String
End Type
Public Dim inType As MyType
Public Dim outType As MyType
Access from anywhere as inType.ID.
Just ignore this if you don't care
/Henning