In VB.NET, however, all you have to do is use the Console Application template available in both VB.NET Express and Visual Studio.
The code below is a really simple Console Application that just displays a message in a Command Prompt window. But then, to go one step further, it also displays a regular Windows form: MsgBox.
Module Module1
Sub Main()
Console.Write("Welcome to Console Applications")
MsgBox("And Welcome Back to the Windows GUI")
Console.ReadLine()
End Sub
End Module
The extra Console.ReadLine() is just there to suspend exectution and keep the Command Prompt window open so you can actually see the message. Otherwise, the window would just flash open and shut again.
From VB.NET, press F5 to run the app in a Command Prompt window. Or, you can open a Command Prompt window and navigate to the Debug folder in the Bin folder of your project and enter the name of your app at the command line. The illustration below shows the results.
--------
Click Here to display the illustration
Click the Back button on your browser to return
--------
In VB.NET, a console application and a Windows application are really not very different. That's why we can move from one to the other so easily. The main difference how Windows will load and run the application. The "EXE" file for a console application has a flag set that tells Windows that it has to be executed inside a Command Prompt window. To be more exact, the flag is set by a compiler option:
/target:exe <for a console application>
... or
/target:winexe <for a Windows application>
This option is selected by the Console Application template but if you ever want to set it yourself, select Console Application in the Application Type dropdown window in the project Properties page.

