What Is the Variable Type

You can find out the type of a variable used in your procedure by right-clicking the variable name and selecting Quick Info from the shortcut menu.

When Visual Basic executes the variable declaration statements, it creates the variables with the specified names and reserves memory space to store their values. Then specific values are assigned to these variables. To assign a value to a variable, you begin with a variable name followed by an equals sign. The value entered to the right of the equals sign is the data you want to store in the variable. The data you enter here must be of the type stated in the variable declaration. Text data should be surrounded by quotation marks and the date by # characters.

Using the data supplied by the DateOfBirth variable, Visual Basic calculates the age of an employee and stores the result of the calculation in the variable called age. Then, the full name of the employee as well as the age are printed to the Immediate window using the instruction Debug.Print.

0 0

Post a comment