Home >>VB.Net Programs >VB.Net program to print backslash (\) character on the console screen

VB.Net program to print backslash (\) character on the console screen

How to print backslash (\) character on the console screen in VB.Net

In VB.Net, we can create a program to print the backslash (\) character using the "\\" double backslash on the console screen.

Program

The source code to print the console screen backslash (\) character is given below. The program given is compiled and successfully executed.


Module Module1
    Sub Main()
        'printing "\" 
        Console.WriteLine("\\")

        'printing between the string "\"
        Console.WriteLine("Hello\\Phptpoint")

        'printing "\"n and "\"t
        Console.WriteLine("\\n\\t")

        'hit ENTER to exit the program
        Console.ReadLine()
    End Sub
End Module
	
Output:
\\
Hello\\Phptpoint
\\n\\t

Explanation:

In the program above, we created a module containing the Main() method, where we used the Console Class WriteLine() method to print the message on the console screen. Here, to print the backslash character on the console screen, we used double backslash '\\'.


No Sidebar ads