Discovering Visual Basic .NET, Page 3
Now, type this:
cd ..\My Documents\HelloWorld
For those of you too young to remember DOS, cd stands for change directory. You can see from the prompt that you are now in the HelloWorld folder. Now type:
vbc starts the Visual Basic compiler. You give it the name of your source code file, HelloWorld.vb, and it is compiled into an executable file. You should see text scroll up the window in response; it looks something like Figure 3.
Figure 3. Compiling HelloWorld.vb.If what you see doesn't look like Figure 3, then, most likely, you typed something in wrong in Notepad. In that case, go back to Notepad and check to be sure what's there is exactly like what appears above. Make any changes necessary, save the file, and compile it again.
Once you have compiled it successfully, you'll notice there's a new file in your folder: HelloWorld.exe. You can run HelloWorld.exe from the command prompt by simply typing its name:
When the program runs, it displays its message (Figure 4).
Figure 4. Your first .NET application in action.
If you want to experiment, go back to Notepad and change the text to whatever you like. Now, save your file. Don't forget to save your file! Switch over to the command prompt, compile again, and run again. This is the process you'll go through a lot as you write programs and test them—so get comfortable with it.
This article laid the groundwork so that you can get started programming in .NET. You installed the .NET Framework on your computer, explored some basic concepts and terms and then wrote, compiled, and ran your first .NET application! In the next article, you'll dive right into the Visual Basic language!
# # #