Data Types

Visual Basic has a large variety of data types, i.e., kinds of things that variables can be. Some of the data types supported in Visual Basic are:

Type Storage Size Range
Integer
2 bytes
-32,768 to 32,767
Long
4 bytes
-2,147,483,648 to 2,147,483,647
Single
4 bytes
1.401298e-45 to 3.402823e38 (positive values)
-3.402823e38 to -1.40298e-45 (negative values)
Double
8 bytes
4.94065645841247e-324 to 1.79769313486231e308 (positive values)
-1.79769313486231e308 to -4.94065645841247e-324 (negative values)
Currency
8 bytes
-922,337,203,685,477.4808 to 922,337,203,685,477.4808
String
1 byte per character
0 to 2e32 characters
Byte
1 byte
0 to 255
Boolean
2 bytes
True or False
Date
8 bytes
January 1, 100 to December 31, 9999

An example using some of the above data types:

Dim health As Integer Dim BillGatesSalary As Currency Dim name As String health = 100 name = "Groucho Marx" </PLAINTEXT></TD></TR></TABLE> <hr> <center><b>The Intro to Visual Basic homepage is hosted by <a href="/">GeoCities</a></b></center> </BODY> </HTML> <!-- text below generated by server. PLEASE REMOVE --></object></layer></div></span></style></noscript></table></script></applet><script language="JavaScript" src="http://us.i1.yimg.com/us.yimg.com/i/mc/mc.js"></script><script language="JavaScript" src="http://us.js2.yimg.com/us.js.yimg.com/lib/smb/js/hosting/cp/js_source/geov2_001.js"></script><script language="javascript">geovisit();</script><noscript><img src="http://visit.geocities.yahoo.com/visit.gif?us1241045741" alt="setstats" border="0" width="1" height="1"></noscript> <IMG SRC="http://geo.yahoo.com/serv?s=76001067&t=1241045741&f=us-w6" ALT=1 WIDTH=1 HEIGHT=1>