Data Type Reference

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Data Type Reference Guide

Data Type Range Bytes

Is the data numeric?

No

Use Boolean, String or Date, as appropriate

Accept a Decimal?

Short Integer Long

-32,768 to 32,767 -2,147,483,648 to 2,147,483,647 -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 1.0e-28 to 7.9e28 Jan 1, 0001 to Dec 31, 9999 0:00:00 to 23:59:59 True or False one Unicode character

2 4 8

No No No

Yes
Decimal

16 8 2 2

Yes

Do you need to do math with the data?

No

Use the String data type (Zip codes, phone numbers, etc.)

Date Boolean Character

Yes

Data Type
Short

Prefix
sho

Does this data have to be a whole number (people, # of items, etc.)?

No

Use the Decimal data type

Integer Long String

int lng str dec dat bln or bol chr

Yes

Decimal Date Boolean

Will the data be outside of the range of 0-255?

No

Use the Byte data type

Character

Variable Declaration
Yes

Dim varName As Type - Where varName is the variable and Type is the data type -Substitute the name of your variable for varName and change Type to the data type for the variable
Use the Integer data type

Will the data be outside of the range of -32,768 to 32,767?

No

Use the Short data type

Yes

Will the data be outside of the range of -2,147,483,648 to 2,147,483,647

No

Constant Declaration
Const SALES_TAX_RATE As Decimal = 0.05 - Const creates a constant that cant be changed - Reserves memory for SALES_TAX_RATE - Declared as a Decimal - Assigns value of 0.05 NOTE: All caps coding standard is different than book - SALES_TAX_RATE cannot changed at runtime - Value can only be changed by changing this line - You MUST give a constant a value when you declare it

Yes

Use the Long data type

You might also like