Data Types

Visual Basic Topics
Post Reply
Cyclops
Lieutenant
Lieutenant
Posts: 71
Joined: Wed Jul 15, 2009 1:48 pm
Location: London

Data Types

Post by Cyclops » Mon Oct 05, 2009 12:23 pm

Data Types

As you may have noticed, VB supports several data types. These are what the main 'Types' that you can declare your variables as. For example:

Dim intCount As Integer

is an Integer. You always should tell Visual Basic what sort of data the variable will hold. This will make your code easier to use, and will also save memory. Different types of variables need different amounts of memory. You need to use the smallest amount of memory. For example, if you will need to store a number from 0 - 255 in a variable, you can save memory by declaring it as a Byte (1 byte) rather than as an Integer (2 bytes). This is not really very much memory, but if you are untidy with all your variables, your application will use much more memory than it has to.

The table below lists the various Data Types, what data they can store and how many bytes they use.
Data Types.jpg
Data Types.jpg (266 KiB) Viewed 2880 times
Post Reply

Return to “Visual Basic Programming”