VB data types

From mi-linux
Revision as of 15:38, 13 September 2007 by Cm1949 (talk | contribs)
Jump to navigationJump to search

Go back to: Visual Basic.Net resources => VB syntax


Data Types in VB.Net

Visual Basic has several different data types available for storing different sorts of data values. It is important that data is stored in the correct type of variable.

Main data types

Data can be divided into two main groupings:

  • Numeric data - which can be used to perform calculations
  • Non-numeric data - such as names, addresses, etc

In general, the distinction is simple - if the data value is a number then it is numeric data. But this does not always work, there are times when it is better to store some numbers as non-numeric values.

If in doubt - ask yourself: Will I want to perform calculations on this value?

  • If Yes - then use a numeric variable.
  • If No - then use a non-numeric variable.
What sort of data is a telephone number?
 e.g. 01902 321234
The number is made up of digits, but would you ever want (for example) to double it?