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

Here, we are going to learn how to print backslash (\) character on the console screen in VB.Net?
Submitted by Nidhi, on November 26, 2020 [Last updated : February 18, 2023]

Printing backslash (\) character

We will create a program in VB.Net to print backslash (\) character using a double backslash "\\" character on the console screen.

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

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

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

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

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

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

        'hit ENTER to exit the program
        Console.ReadLine()
    End Sub

End Module

Output:

\\
Hello\\World
\\n\\t

Explanation:

In the above program, we created a Module that contains the Main() method, here we used the WriteLine() method of Console class to print the message on the console screen. Here, we used double backslash "\\" to print backslash character on the console screen.

VB.Net Basic Programs »





Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.