×

VB.Net Programs

VB.Net program to demonstrate the difference between Console.Write() and Console.WriteLine() methods

By Nidhi Last Updated : November 11, 2024

Console.Write() Vs Console.WriteLine() in VB.Net

We will create a program in VB.Net to demonstrate the difference between Console.Write() and Console.WriteLine() methods.

VB.Net code to demonstrate the difference between Console.Write() and Console.WriteLine()

The source code to demonstrate the difference between Console.Write() and Console.WriteLine() methods is given below. The given program is compiled and executed successfully.

'Program to demonstrate the difference between 
'Console.Write() and Console.WriteLine() method.

Module Module1

    Sub Main()
        Console.WriteLine("This is line1")
        Console.WriteLine("This is line2")
        Console.Write("This is line3")
        Console.Write("This is line4")
        
        Console.ReadLine()
    End Sub

End Module

Output:

This is line1
This is line2
This is line3This is line4

Console.Write() Vs Console.WriteLine() Explanation

Here, we created a Module that contains the Main() method, and we used Write() and WriteLine() methods of Console class.

Console.WriteLine("This is line1")
Console.WriteLine("This is line2")

Here, we used WriteLine() method message on the console screen, WriteLine() method print newline character to change the line.

Console.Write("This is line3")
Console.Write("This is line4")

Here, we used the Write() method message on the console screen, Write() method does not print newline character.

VB.Net Basic Programs »


Comments and Discussions!

Load comments ↻





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