VB.NET TUTORIALS - VB.Net - Variables
VB.Net - Variables
ADVERTISEMENTS
Type | Example |
---|---|
Integral types | SByte, Byte, Short, UShort, Integer, UInteger, Long, ULong and Char |
Floating point types | Single and Double |
Decimal types | Decimal |
Boolean types | True or False values, as assigned |
Date types | Date |
ADVERTISEMENTS
Variable Declaration in VB.Net
[ ] [ accessmodifier ] [[ Shared ] [ Shadows ] | [ Static ]] [ ReadOnly ] Dim [ WithEvents ] variablelistADVERTISEMENTS
variablename[ ( [ boundslist ] ) ] [ As [ New ] datatype ] [ = initializer ]
Dim StudentID As Integer Dim StudentName As String Dim Salary As Double Dim count1, count2 As Integer Dim status As Boolean Dim exitButton As New System.Windows.Forms.Button Dim lastTime, nextTime As DateVariable Initialization in VB.Net
variable_name = value;
Dim pi As Double pi = 3.14159
Dim StudentID As Integer = 100 Dim StudentName As String = "Bill Smith"Example
Module variablesNdataypes Sub Main() Dim a As Short Dim b As Integer Dim c As Double a = 10 b = 20 c = a + b Console.WriteLine("a = {0}, b = {1}, c = {2}", a, b, c) Console.ReadLine() End Sub End ModuleAccepting Values from User
Dim message As String message = Console.ReadLine
Module variablesNdataypes Sub Main() Dim message As String Console.Write("Enter message: ") message = Console.ReadLine Console.WriteLine() Console.WriteLine("Your Message: {0}", message) Console.ReadLine() End Sub End ModuleLvalues and Rvalues
Dim g As Integer = 20
20 = g