Joined: 16 Jan 2006 Posts: 2483 Location: Queensland
Posted: Fri Mar 07, 2008 1:00 am Post subject:
Dim declares the variable as global, regardless of the fact that its in a Sub. You must use Local if you want it local to that sub. _________________ Adrian Jansen
Computer language is a framework for creativity
The scope for DIM is global. So no matter where you use the DIM statements, the variable will
end up as a global visible variable that is visible in all modules, procedures and functions.
When you need a LOCAL variable that is local to the procedure or function, you can use LOCAL.
* * *
A LOCAL variable is a temporary variable that is stored on the frame.
When the SUB or FUNCTION is terminated, the memory will be released back to the frame.
Since LOCAL variables are stored on the frame, it takes more code to dynamic generate and clean up these variables.
Local BIT variables are not possible because they are GLOBAL to the system.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum