1.1. Create a Console Application from the Command Line

Problem

You need to use the VB .NET command-line compiler to build an application that does not require a Windows graphical user interface (GUI) but instead displays output to, and reads input from, the Windows command prompt (console).

Solution

In one of your classes, ensure you implement a Shared method named Main with one of the following signatures:

Public Shared Sub Main()
End Sub
Public Shared Sub Main(ByVal args As String())
End Sub
Public Shared Function Main() As Integer
End Sub
Public Shared Function Main(ByVal args As String()) As Integer
End Sub

Build your application using the VB .NET compiler (vbc.exe) by running the following command (where HelloWorld.vb is the name of your ...

Get Visual Basic 2008 Recipes: A Problem-Solution Approach now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.