Visual Basic 2008 Programming: Business Applications with a Design Perspective
Chapter 1 Chapter 2 Chapter 3 Chapter 4 Chapter 5 Chapter 6 Chapter 7 Chapter 8 Chapter 9
Chapter 10 Chapter 11 Chapter 12 Chapter 13 Chapter 14 Appendix A Appendix B Appendix C Home
Last change: February 13 2016 18:48:19.

 Chapter in PDF

Table of Contents

Chapter 4: Data, Operations, and Built-In Functions
Last change: February 13 2016 18:47:36.

Declaring Numeric Data Types

As explained in Section 4.1, “Classification and Declaration of Data ,” you can declare a numeric variable using the following syntax:

Dim name As data type


Dim name+type suffix

You probably have noticed in the first table that not all data types can be declared with a type suffix. Again, for code clarity, avoid declaring variables with type suffixes.
Here are some examples of variable declarations:

Dim NewRec As Boolean ‘Declare NewRec as Boolean type Dim NumberOfEmployees As Integer ‘Declare # of employees as integer Dim RecordCount As Long ‘Declare RecordCount as long Dim HourPay As Single ‘Declare hour pay as single Dim BillsIncome As Double ‘Declare Bill’s income as double Dim Amount As Decimal ‘Declare Amount as Decimal

Last change: February 13 2016 18:47:37.