1. Home
  2. Computing & Technology
  3. Visual Basic

Chapter 10 - Using Modules and Procedures - Part 2

By , About.com Guide

3 of 7

Building and Running a Console Application

To prove it, let's build and run a console application from the DOS Command Prompt window without any help from Visual Studio. Here are the steps:

1 - Create your program! Instead of Visual Studio, use Notepad! Enter the program shown above but add this statement between Sub Main() and End Sub:

~~~~~~~~~~~~~~~~~~~~~~~~~
System.Console.Writeline("Hello About Visual Basic")
~~~~~~~~~~~~~~~~~~~~~~~~~


Save the program using the name TestConsole.vb. It would be a good idea to create a new folder for this. I used C:\testvbc.

Hint: If you're surfing the web for other examples, you may notice that many other sites and even Microsoft's pages don't include the System Namespace in similar program statements. If you leave it out, the compiler gives you a funky "variable not declared" error. What is actually happening is that the compiler doesn't recognize Console.Writeline so it assumes that it's something of yours and it's not declared - an error in VB.NET. You have to tell the compiler, "Hey! It's in the System Namespace, Dummy!"

Computers! You gotta tell them everything!

Explore Visual Basic
By Category
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Visual Basic
  4. Learn VB.NET
  5. Using Modules and Procedures - Part 2

©2009 About.com, a part of The New York Times Company.

All rights reserved.