Concatenate strings in Console.WriteLine statement
Module Module1
Sub Main()
Dim WebSite As String
Dim Publisher As String = "AAAA"
Console.WriteLine("AAAA: " & Publisher)
WebSite = "CCCC." & Publisher & ".DDDD"
Console.WriteLine("String one " & WebSite)
End Sub
End Module
AAAA: AAAA
String one CCCC.AAAA.DDDD
Output string to the Console
Module Module1
Sub Main( )
Console.WriteLine("Hello from Module")
End Sub
End Module
Hello from Module
Reference variable index in Console.WriteLine
Module Module1
Sub Main()
Dim A As Double = 1.23456789
Console.WriteLine("{0} {1} {2}", 1, 2, 3)
End Sub
End Module
1 2 3
Use Console.WriteLine to display various type variables
Module Module1
Sub Main()
Dim A As Integer = 100
Dim B As Double = 0.123456789
Dim Message As String = "Hello, VB World!"
Console.WriteLine(A)
Console.WriteLine("The value of A is " & A)
Console.WriteLine(B)
Console.WriteLine(B & " plus " & A & " = " & B + A)
Console.WriteLine(Message)
End Sub
End Module
100
The value of A is 100
0.123456789
0.123456789 plus 100 = 100.123456789
Hello, VB World!
Variable index
Public Class Tester
Public Shared Sub Main
Console.WriteLine(String.Format( _
"There are about {0} days in {1} years.", _
365.25 * 3, 3, 17))
End Sub
End Class
There are about 1095.75 days in 3 years.
Write some text based on the specified data type
Module Module1
Sub Main()
Console.Write(True)
Console.Write(25)
Console.Write("Some text.")
Console.WriteLine()
Console.WriteLine()
Console.WriteLine(True)
Console.WriteLine(25)
Console.WriteLine("Some text.")
End Sub
End Module
True25Some text.
True
25
Some text.