Posts

Showing posts from 2018

VB_0005_Array3

Module Module1     Sub Main()         ' For writing lengthy texts " & _ "         Dim myText As String = "MATHI xxxxxxxxxxxxxxxxxx" & _                                          "xxxxxxxxxxxxxx.SURAJ"         Dim charArray() As Char = myText.ToCharArray()         Array .Reverse(charArray)         For Each mychar As Char In charArray             ' just use "Write" to get single line output             Console .Write(mychar)         Next         Console .ReadLine()     End Sub End Module Result: JARUS.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx IHTAM

VB_0005_Array2

Module Module1     Sub Main()         Dim names() As String = { "MATHI", "SUJITHRA", "SURAJ", "SHAKTHI"}         For Each name As String In names             Console. WriteLine(name)         Next         Console .ReadLine()     End Sub End Module

VB_0005_Array1

Module Module1     Sub Main()         'Arrays always start with 0         Dim numbers(0 To 4) As Integer         numbers(0) = 4         numbers(1) = 8         numbers(2) = 15         numbers(3) = 16         numbers(4) = 23         Console .WriteLine( "The 3rd element in the array:" & numbers(2))         Console .WriteLine( "Iterating the entire array" )         'numbers.length gives Total Elements in the Array in numerical value         For index = 0 To numbers.Length - 1             Console. WriteLine(numbers(index))         Next         Console .ReadLine()     End Sub End Module

VB_0004_ForNext2

Module Module1     Sub Main()         For x = 10 To 5 Step -1             Console. WriteLine(x)         Next         Console .ReadLine()     End Sub End Module

VB_004_ForNext1

Module Module1     Sub Main()         For index = 1 To 10                           If index = 7 Then                 Console .WriteLine( "Seven Found" )                 Exit For             End If             Console .WriteLine(index)         Next         Console .ReadLine()     End Sub End Module

VB_003_Decision4

Module Module1     Sub Main()         Console .WriteLine( "Please enter 1 or 2 or 3" )         Dim userValue As String         userValue = Console .ReadLine() 'IIf -          Dim message As String = IIf(userValue = "3", "BIKE", "HOUSE")         Console .WriteLine( "You entered:{1}...So you won a {0}!" , message, userValue)         Console .ReadLine()     End Sub End Module

VB_0003_Decision3

Module Module1     Sub Main()         Console .WriteLine( "Your choice 1 or 2 or 3" )         Dim userValue As String         userValue = Console .ReadLine()         Dim message As String         If userValue = "1" Then             message = "1:You won the CAR"         ElseIf userValue = "2" Then             message = "2:You won HOUSE"         ElseIf userValue = "3" Then             message = "3:You won BIKE"         Else             message = " Sorry...wrong choice"         End If         Console .WriteLine(message)         Console .ReadLine()     End Sub End Module

VB_0003_Decision1

Module Module1     Sub Main()         'Get user input         Dim userValue As String         Console .WriteLine( "Type your name:" )         userValue = Console .ReadLine          Cons ole .WriteLine( "Your typed name as:" & userValue)         Console .ReadLine()     End Sub End Module

VB_0003_Decision2

Module Module1     Sub Main() 'IF and ElseIf         Dim userValue As String         Console .WriteLine( "Type your choices 1 or 2 or 3" )         userValue = Console .ReadLine         If userValue = "1" Then             Console .WriteLine( "You typed 1: You won the CAR" )             Console .ReadLine()         ElseIf userValue = "2" Then             Console .WriteLine( "You typed 2: You won the HOUSE" )             Console .ReadLine()         ElseIf userValue = "3" Then             Console .WriteLine( "You typed 3: You won the BIKE" )             Console .ReadLine()         Else             Conso...

VB_0002_Variable4

Module Module1     Sub Main()         Dim x As String = "Mathi"         Dim y As Integer = 39         'CStr and CInt are for Convert to String and Convert to Integer         Dim name As String = x & CStr (y)         Console .WriteLine(name)         Console .ReadLine()     End Sub End Module

VB_0002_Variable3

Module Module1     Sub Main()         Dim x As String = "Mathi"         Dim y As String = "  Krishnan"         Dim name As String = x.ToUpper & y.ToUpper         Console.WriteLine(name)         Console.ReadLine()     End Sub End Module

VB_0002_Variable2

Module Module1     Sub Main()         Dim x As String = "Mathi"         Dim y As String = " Krishnan"         Dim name As String = x & y         Console .WriteLine(name)         Console .ReadLine()     End Sub End Module

VB_0002_Variable1

Module Module1     Sub Main()         Dim x As Integer = 7         Dim y As Integer = 3         Dim z As Integer = x + y         Console .WriteLine(z)         Console .ReadLine()     End Sub End Module

VB_0001_HelloWorld

Module Module1     Sub Main()         Console.WriteLine( "Hello World!" )         Console.ReadLine()     End Sub End Module