Memory concepts  

Variable names are used to reference locations in memory.  Although each memory location has an explicit address assigned to it, it is much easier for programmer to work with variable names rather than addresses.  Each memory location is capable of storing a value, and the type of the value stored depends on the type of variable associated with that memory location.

In the following example, sum has been dimensioned as an Integer variable.  It has either been explicitly initialized to 0, or has the default value.  The statement sum = sum + txtInput.Text will read the current value of sum, add to it the value that was entered into the text box txtInput, and store the resulting value back into the memory location referenced by sum

fig3_13.jpg (19828 bytes)

Note that although the value read by txtInput.Text is a String value, it is implicitly converted to a numeric value by VB before it is added to sum.