Visual Basic 2013 Lesson 8: Understanding Data
Visual Basic 2013 Lesson 8: Understanding Data
Data
We deal with many kinds of data in our daily life. For example, we need to handle data like
names, phone number, addresses, money, date, stock quotes, statistics and other data every
day. Similarly in Visual Basic 2013, we have to deal with all sorts of of data, some of them
can be mathematically calculated while some are in the form of text or other non-numeric
forms. In Visual Basic 2013, data can be stored as variables, constants or arrays. The values
of data stored as variables always change, just like the contents of a mail box or the storage
bin while the value of a constant remains the same throughout. (We shall deal with variables,
constants and arrays in coming lessons)
Numeric data types are types of data comprises numbers that can be calculated
mathematically using various standard operators such as addition, subtraction, multiplication,
division and more. Examples of numeric data types are examination marks, height, body
weight, number of students in a class, share values, price of goods, monthly bills, fees , bus
fares and more. In Visual Basic 2013, numeric data are divided into seven types based on the
range of values they can store. Calculations that only involve round figures or data that do not
need high precision can use Integer or Long integer . Programs that require high precision
calculation need to use Single and Double precision data types, they are also called floating
point numbers. For currency calculation , you can use the currency data types. Lastly, if even
more precision is required to perform calculations that involve many decimal points, we can
use the decimal data types. These data types are summarized in Table 8.1
Non-numeric data types are data that cannot be manipulated mathematically using standard
arithmetic operators. The non-numeric data comprises text or string data types, the Date data
types, the Boolean data types that store only two values (true or false), Object data type and
Variant data type .They are summarized in Table 8.2
Literals are values that you assign to data. In some cases, we need to add a suffix behind a
literal so that VB can handle the calculation more accurately. For example, we can use
num=1.3089# for a Double type data. The suffixes are summarized in Table 8.3.
Table 5.3
In addition, we need to enclose string literals within two quotations and date and time literals
within two # sign. Strings can contain any characters, including numbers. The following are
few examples:
memberName=”Turban, John.”
TelNumber=”1800-900-888-777″
LastDay=#31-Dec-00#
ExpTime=#12:00 am#