VB.NET Tutorial: first program with VB.NET


First program with VB.NET

Open Visual Studio.NET; create a new project (Ctrl+Shift+N)

and select Console Application.

vb console 

You can accept the default file name and click OK.
Then, you will see the code block:

Module Module1
 
  Sub Main()
  End Sub
 
End Module
 
Now, you will do some changes in Main procedure as shown below:
 
Module Module1
 
  Sub Main()
    Console.WriteLine("My First VB.NET Program")’print text on the screen
    Console.ReadLine()’wait for key input
  End Sub
 
End Module
 
When you are ready, press F5 to run your program with debugging. You will see the following output console window:

VB.NET Ouput window

-Main procedure is where your program will start.
-Console.WriteLine statement will print text “My VB.NET First Program” on the screen.
-Console.ReadLine statement waits for key input and then the program will exit after you press any key.
-To comment code, VB.NET uses single quote (').




Comments

CAPTCHA image




This website intents to provide free and high quality tutorials, examples, exercises and solutions, questions and answers of programming and scripting languages:
C, C++, C#, Java, VB.NET, Python, VBA,PHP & Mysql, SQL, JSP, ASP.NET,HTML, CSS, JQuery, JavaScript and other applications such as MS Excel, MS Access, and MS Word. However, we don't guarantee all things of the web are accurate. If you find any error, please report it then we will take actions to correct it as soon as possible.