Console Applications in VB.NET 2008

What are Console Applications in VB.NET?

Explanation

Console Applications in VB.NET 2008

Console Applications in VB.NET 2008 is used to reduce the space occupied by Windows Application usually developed in Vb.net. Using the Console Application, a user is prompted to input data and display the output in a DOS prompt.
Console applications can be created by opting New Projects->Console Application

All the Console Applications by default have a module Module1 and the code is included inside Sub Main() - End Sub. Just like VB.net applications the code is executed using Debug->Start Debugging option. But the result is displayed in a Console Window or a DOS Window instead of a form.
Example:

Module Module1
Sub Main()
System.Console.WriteLine("HELLO WORLD")
System.Console.ReadLine()
End Sub
End Module
Result:

HELLO WORLD

In the above example the text "HELLO WORLD" is displayed in the Console Window.
Namespace:

In the above example, System.Console is a namespace, which is a collection of classes and datastructures that can be used for a specific purpose.
Module:

A Module contains a group of functions. Modules are used to create common functions, that can be called from anywhere if declared as 'Public'.

Visual Basic Tutorial


Ask Questions

Ask Question