VB.NET Tutorial: Create Your First Console Application

In this tutorial you will understand how to create simple  vb.net console application.

Look at the code below

Module Module1

Sub Main()
 Console.WriteLine("hi this is my first console application in vb.net")
 Console.Write("hi  ")

Dim abc As String

Console.WriteLine("write line that i'll print on next line")
 abc = Console.ReadLine()



End Sub

End Module

In VB you don’t need to put semicolon to indicate end of line.

The following indicates that when you select console application that is displayed on your screen i.e

Module Module1

    Sub Main()


End Sub

End Module

console.WriteLine  or  console.Write

The only difference between console.WriteLine  and  console.Write is console.Write doesn’t shift cursor to next line after printing

amd WriteLine passes cursor to next line after printing.

In Visual Studio start typing console it will suggest you console and further.

Dim abc As String

in vb.net variables are declared in this manner.

if you want to use  integer then write Dim d As integer

you are using variable abc as string.

abc = Console.ReadLine()

console.ReadLine() function reads whole line.

so in this program we are storing whole line in string abc


console.Read() works in same as getchar() in c

see the output


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s