Author | Message | Time |
---|---|---|
bRoKeN | 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 | February 21, 2004, 1:15 PM |
Adron | 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. | February 21, 2004, 1:30 PM |
j0k3r | This belongs in the Visual Basic forum. | February 21, 2004, 1:59 PM |
bRoKeN | Thank you Adron, and sorry jok3r now i know for next time. | February 21, 2004, 2:15 PM |
Stealth | [quote author=Panda link=board=31;threadid=5388;start=0#msg45331 date=1077369323] Can some please brake this down for me. Visual Basic Data Types: Data Type Suffix Boolean None [/quote] Booleans are either TRUE or FALSE. They require two bytes of memory. [quote] Integer % [/quote] Integers are numeric variables that take up two bytes. They are signed, so they range from +/- 32767. [quote] Long (Integer) &[/quote] Longs are 4-byte signed numeric variables. They range from +/- 2.4 billion or so. [quote] Single (Floating) ! Double (Floating) # [/quote] 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. [quote]Currency @[/quote] Currency is an 8-byte type that is specially formatted to handle currency. [quote] Date None [/quote] 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[/quote] Objects are general-use variables that can be references to objects. [quote] String $ [/quote] Strings are 12 bytes plus the length of the string. They contain ASCII characters. [quote] Variant None[/quote] 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 [/quote] can also be stated as [quote] Dim strInput$ [/quote] 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. | February 21, 2004, 11:43 PM |
bRoKeN | Thank you stealth. That's a way better explanation. Now i understand. | February 22, 2004, 2:02 AM |
Skywing | Note that Strings can be Unicode, too, particularly if you have a typelib for some import and are passing it a string. | February 22, 2004, 5:37 PM |
Adron | Strings are actually Unicode by default in VB. | February 23, 2004, 1:21 AM |