Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
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 Module
Imports System.Text.RegularExpressions
Module regexProg
Sub Main()
Dim input As String = "Hello World "
Dim pattern As String = "\\s+"
Dim replacement As String = " "
Dim rgx As Regex = New Regex(pattern)
Dim result As String = rgx.Replace(input, replacement)
Console.WriteLine("Original String: {0}", input)
Console.WriteLine("Replacement String: {0}", result)
Console.ReadKey()
End Sub
End Module
'Module Decide
'Sub Main()
'Dim a As integer = 8
'If (a > 4) Then
'Console.WriteLine("a is greater 4")
'End if
'Console.WriteLine("a is : {0}", a)
'End Sub
'End Module
' interation for loop
'Module loops
'Sub Main()
'Dim a As Byte
'Dim b As integer
'' for loop execution
'For a = 10 To 20
' b = a*12
'Console.WriteLine("value of a: {0}", b)
' Next
' Console.ReadLine()
' End Sub
'End Module
' Accessing an array
Module
Module VBModule
Sub Main()
Dim name as String
Console.WriteLine("Hello, world!")
name = Console.ReadLine()
Console.WriteLine("Nice to meet you, " & name)
End Sub
End Module
Module VBModule
Dim a As Integer
Dim firstname() As String = {"james", "sam", "jack", "lee", "moriss", "fape", "king", "jane", "mac", "matthew"}
Dim lastname() As String = {"chong", "yan", "lei", "chen", "hole", "king", "kong", "willson", "don", "los"}
Sub Main()
For a = 0 To 9
Console.WriteLine(firstname(a) + "" + lastname(a))
Next
Console.ReadKey()
End Sub
End Module
Module VBModule
Sub Main()
Dim months()as string = {"January","February","March","April","May","June","July","August","September","October","November","December"}
array.reverse(months)
dim i as integer
for i = 0 to 11
Console.writeline (months(i))
next i
End Sub
End Module
Module VBModule
Sub Main()
Dim arquivo As New IO.StreamWriter("C:\NETLEX\out.txt", True)
arquivo.Write("Lorem ipsum")
''arquivo.write(vbCrlf & "dolor sit amet,")
arquivo.Close()
End Sub
End Module
Module VBModule
Sub Main()
Dim n= Console.ReadLine
While
If Integer.TryParse(Console.ReadLine,n) Then
isPrime()
getReverse()
If isPrime=True
Console.WriteLine(n & "is a prime number.")
ElseIf isPrime=False
Console.WriteLinw(n & "is not a prime number.")
Else
Console.WriteLine("ERROR: the input is not an integer")
Next
Private Function isPrime(By Val n as Integer) As Boolean
End Function
Private Function getReverse(ByVal n as Integer) As Integer
Dim r As Integer
r=Integer.Parse.StrReverse(n)
End Function
End Sub
End Module
Module VBModule
Sub Main()
dim AR() As String
redim Preserve AR(100)
dim cnt As Integer = 1
dim ind As Integer = 1
While cnt < 100
cnt = cnt + 2
AR(ind) = cnt
ind = ind + 1
End While
Console.WriteLine(AR(5))
End Sub
End Module