Tuesday, November 25, 2014

Variables and Data Types VB.NET

  No comments    
categories: 
Variables and Data Types VB.NET

1.    Variable is what the program used to store value in computer’s memory.
2.     Data Type of variables tell the computer to store different types of value such as number, text string, date, currency, and true/false, They also inform the computer to reserve different memory’s spaces for those variable.


Declared and Access Variable
In VB.NET, a variable can be declared using the following prototype.
Dim Variable_name As Datatype
To declare a variable, you will use keyword Dim before name of the variable followed by keyword As and type data to be stored in memory.

Here is the list of data type that can be used in VB.NET







For More Click Here About Variables and Data Types VB.NET

Example:

Module Module1 (you can change Module1 to other name that you want)

Module Module1

    Sub Main()
        Dim x As Integer
        Dim d As Double
        Dim b As Boolean
        'Accessing Variables
        x = 10
        b = 11223323
        b = True
        Console.WriteLine("x=" & x)
        Console.WriteLine("d=" & d)
        Console.WriteLine("b=" & b)
        Console.ReadKey()
    End Sub

End Module




This is a result



0 comments:

Post a Comment