Denoting a Variable’s Data Type
Table 3-1 lists the prefixes you can use to denote a variable’s data type.
If you’re unsure of what prefix to use, use obj. For instance, when automating Microsoft Word, you might create an instance of Word’s Application object. Because no prefix has been designated specifically for Word objects, obj works just fine, as shown in the following statement:
Dim objWord As Word.Application
Data Type | Prefix | Example |
---|---|---|
Boolean | bln | blnLoggedIn |
Byte | byt | bytAge |
Char | chr | chrInitial |
Decimal | dec | decInterestRate |
Double | dbl | dblMiles |
Integer | int | intAge |
Long | lng | lngOnHand |
Object | obj | objUserTable |
Short | srt | srtTotalIterations |
Single | sng | sngYears |
String ... |
Get Practical Standards for Microsoft® Visual Basic® .NET, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.