Can some please brake this down for me.
Visual Basic Data Types:
Data Type Suffix
Boolean None
Integer %
Long (Integer) &
Single (Floating) !
Double (Floating) #
Currency @
Date None
Object None
String $
Variant None
That's for when you don't declare variables "As Sometype". If you don't use "Option Explicit", you can use any variable name and it'll be. And if you then want it to have some particular type, you'll want to name it with a suffix from that list.
This belongs in the Visual Basic forum.
Thank you Adron, and sorry jok3r now i know for next time.
Quote from: Panda on February 21, 2004, 07:15 AM
Can some please brake this down for me.
Visual Basic Data Types:
Data Type Suffix
Boolean None
Booleans are either TRUE or FALSE. They require two bytes of memory.
Quote
Integer %
Integers are numeric variables that take up two bytes. They are signed, so they range from +/- 32767.
Quote
Long (Integer) &
Longs are 4-byte signed numeric variables. They range from +/- 2.4 billion or so.
Quote
Single (Floating) !
Double (Floating) #
Singles are 4-byte floating-point (decimal) numbers. I am not sure as to their range, but because they have a decimal, they are more precise than Longs. Doubles are 8-byte versions of Singles, allowing for even greater precision.
QuoteCurrency @
Currency is an 8-byte type that is specially formatted to handle currency.
Quote
Date None
Date is also an 8-byte variable that is made up of two formatted Longs whose values point to a specific date and time.
Quote
Object None
Objects are general-use variables that can be references to objects.
Quote
String $
Strings are 12 bytes plus the length of the string. They contain ASCII characters.
Quote
Variant None
Microsoft's beastly Variant datatype requires 64 bytes and can act as any variable type necessary. Avoid using Variants unless they're absolutely necessary or make sense in the current situation.
The suffixes are used as such:
Quote
Dim strInput as String
can also be stated as
Quote
Dim strInput$
It is generally better form to use "As Type" instead of the suffixes. They are a bit of a throwback to previous versions of VB.
Thank you stealth. That's a way better explanation. Now i understand.
Note that Strings can be Unicode, too, particularly if you have a typelib for some import and are passing it a string.
Strings are actually Unicode by default in VB.