devonmanelski.com |
  |
Home | I.T. Management | Business Analysis & Project Management | VB.Net | SQL Server | About | |
A variable is a storage location which stores a Variable Value or a Reference to the Memory Location in which the Variable Value is stored. Variables contain values of specific Data Types: Character, String, Number, Date/Time, Boolean (True/False), Binary (0/1), Object (Class), Array, Collection, Structure and List. Instead of repeatedly typing the information that is stored in a Variable, a Variable Name is assigned to the Variable which is then used to access the Value of the Variable. Once the Variable Value has been assigned to a Variable Name, the Variable Name can be used in place of typing the Variable Value. Therefore, in order to access the Variable Value, a programmer can simply type the name of the Variable.
Variable Application Scope defines where a Variable can be accessed within an Application’s Classes and Modules1. Global Variables can be accessed anywhere within an Application's Scope. Private Variables can be accessed anywhere within a Class or Module Application Scope. Procedural-Level Variables2 are only accessible from within the Function or Sub Procedure's Application Scope.
There are two types of Variable Data Types: Fundamental Data Types and Complex Data Types. The Fundamental Data Types are the more typical Variable Data Types in computer programming: Byte, Integer, Char, String, Date/Time, and Constants. The Complex Data Types are Recordsets, Collections, Arrays, Instances of Classes, Objects, Enumerations, Structures and Lists. Reference Type Variables, and Arguments passed to a procedure
ByRef
Public Sub mDoubleNumber(ByRef iNumberToDouble as Integer)
iNumberToDouble = iNumberToDouble * 2
End Function
The Variable Value of the Variable that was passed as an argument to the mDoubleNumber Function is now twice the value that was passed to the Function.
, store a Pointer to the Memory Address in which the Variable Value is stored and can be updated in the Computer's Memory. Value Type Variables, and Arguments passed to a procedure
ByVal
Public Function mDoubleNumber(ByVal iNumberToDouble as Integer) as Integer
mDoubleNumber = iNumberToDouble * 2
End Function
After the mDoubleNumber Function has completed, the Variable Value of iNumberToDouble is still the original Value that was passed to the Function as an argument .
, store their own copy of the Variable Value in a new memory location.
In Summary, Reference Type Variables and Arguments make it possible for programmers to update Variable Values across the distinct Variable Scopes available with an Application Instance. By storing a Pointer to a specific location in the Computer's Memory, functions and procedures in distinct Application Scopes of an Application Instance can access and update Variable Values using the Pointer to the Variable's location in the Computer's Memory.