VB.NET from beginner to advanced programmer
- Introduction and Installation
- Objects and Events
- Variables
- The basic data types
- Logical Operators
- Relational Operators
- If statements Then
- Arithmetical Operators
- Loops Part 1
- Arrays
- Loops Part 2
- Try Catch statements
- Subs and Functions
- Difference between Scopes
- Select Statements
- Multidimensional arrays
- Structures
- Classes
- Enumerations
- Advanced Comments
- Compiling Directives
From the last part you learned that variables and constants use different types depending on what values that should stored in them. This Part will teach you the basic types so you know what to use.
Boolean
A boolean value is either True or False. Boolean values are important when using logical operators and relational operators(See part 5 and 6 for more info).
Integer
The Integer types can (of course) store Integer values. There is three sizes of Integers which all can be both Signed and Unsigned and can be written in to ways for a total of 12 "different" types.
Short or Int16
The smallest of them, can store values with a 65,535 long span.
Integer or Int32
The medium size , can store values with a 4,294,967,295 long span.
Long or Int64
The Largest of them all , can store values with a 18,446,744,073,709,551,615 long span.
By adding a "U" to them they become unsigned(UInt32,ULong etc.), When they are Unsigned the span starts from 0 and goes up, and when they are signed they have the half span below 0 and the other half above.
For example, Short(or Int16) has the span length 65,535.
If it's signed(Short or Int16) it has the span from -32,768 to 32,767.
And if it's unsigned(UShort or UInt16) the span goes from 0 to 65,535.
Single
The single type is a numeric type which can store decimals too. It can store values from 1.401298*10-45 to 3.4028235*1038 for both positive and negative values with a total of 7 decimal places.
Double
The type double, is also a numeric type with decimal places. The double can store bigger(and smaller) values then the Single. The span goes from -4.94065645841246544*10-324 through 1.79769313486231570*10308 for both positive and negative values. The Double can store a total of 15 decimals.
String
The string type can store text. To write a string you start with one double quote and end with another, like this:
Dim sMessage ="This is a string"
In a string variable you can store up to aproximatelly 2 billion(!) Unicode characters.
Char
Only stores one character, as with Strings you surrounds it by double quotes.
Now you should be able to use the basic types, see you in next part, Part 5.
Edited by Vswe, 21 March 2010 - 02:25 PM.


Sign In
Create Account


Back to top









