Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Bookstore...
 
Feedback
Tip Jar
 
XML RSS Feed
 
 
 
MSDN Visual Basic Community
 
 
 
 
 
 
 
  Tip: Visual Basic Data Type Characters  
 
 

I always have trouble finding this information because the search keywords are so general they return too many hits of the wrong type. So here's my own version that I can hopefully find more easily.

Data Type Characters

The following table lists Visual Basic's type characters. For example, suppose you declare a variable using this code.

    Dim x!

Then x is a Single.

Data TypeCharacter
Decimal @
Double #
Integer %
Long &
Single !
String $

I don't recommend using these type characters because I think they make the code harder to understand but it's nice to have this table so you can understand other people's code.


Literal Type Characters

You can use literal type characters to give a literal a specific type. For example, the following sets variable x equal to a Single value rather than the Integer which is the default for literal values with this format.

    Dim x As Object = 10S

The following table lists the literal type characters.

Data TypeCharacter
Char C
Decimal D
Double R
Integer I
Long L
Short S
Single F
UInteger UI
ULong UL
UShort US

 

Copyright © 1997-2008 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated