VB.NET Data Types

Data Types


In this lesson, you will familiarize yourself with the Visual Studio VB.NET accepted data types.

A “data type” is a class that is primarily used just to hold data. This is different from most other classes since they’re primarily intended to ‘do something’, like access a database or or format a page for example. Although data types can “do something” as well (that is, they also have methods), this isn’t their main purpose.

The list below shows the data types that are defined in the .NET System namespace.

Boolean – true or false

Byte – 8 bit unsigned integer

Char – 16 bit Unicode character

DateTime – date and time of day

Decimal – decimal number

Double – 64 bit floating-point number

Int16 – 16 bit signed integer

Int32 – 32 bit signed integer

Integer – 32 bit signed integer

Int64 – 64 bit signed integer

SByte – 8 bit signed integer

Single – 32 bit floating-point number

UInt16 – 16 bit unsigned integer

UInt32 – 32 bit unsigned integer

UInt64 – 64-bit unsigned integer

 

Declaring Variables


To declare a variable use:

VB.NET

Dim [var_name] as [type]

Dim strName as String

Dim intAge as Integer

Assigning a value to a variable

You can assign a value to a variable using the “=” sign.

strName=”Joan”

Dim strLastName as string =”McDonald”

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s