Discovering Visual Basic .NET
In this article series, you'll discover the fundamental information you need to begin writing real programs in the most widely used programming language in the world: Visual Basic. In this article, specifically, I'll describe what you need to get going and how to get it. I'll also cover some basic concepts and terms that will lay the foundation for creating your own .NET programs. Finally, before you finish this first article in the series, you will have created and run your first .NET application.
You may have heard that you need special applications to write your own programs. Microsoft sells Visual Studio .NET, for example, to professional developers. Tools like this are called IDEs (Integrated Development Environments) and they provide a comfortable place for developers to write large applications, putting at their fingertips a load of tools for writing, testing, and fixing programs. Although these applications can be helpful to programmers who do this for a living, you don't need all that complexity (and cost!) when you are just getting started.
In fact, you don't have to buy anything. All you need is the .NET Framework, which you can download and install for free.
Getting the .NET Framework
The .NET Framework is the foundation of all .NET applications. You'll need two pieces:
- The Microsoft .NET Framework Redistributable Package—The essential foundation needed on any computer to run .NET applications.
- The Microsoft .NET Framework Software Development Kit (SDK)—This is a set of tools, examples, and help files that help you write your own .NET applications.
To get the Redistributable Package, go to:http://www.microsoft.com/downloads/details.aspx?familyid=262D25E3-F589-4842-8157-034D1E7CF3A3&displaylang=en
To get the SDK, go to:http://www.microsoft.com/downloads/details.aspx?FamilyId=9B3A2CA6-3647-4070-9F41-A333C6B9181D&displaylang=en
The only catch is that you need a high-speed connection—the SDK is about 108MB! If you want to download it in pieces, there's a link along the right side of that page that will take you to another page where you can do that. There's also a link that allows you to order the framework on a CD, if you prefer.
Run the Redistributable Package install first. You'll have to accept Microsoft's End User License Agreement, but there are no other decisions to make. It should take a couple of minutes.
The SDK install is only slightly more complicated. You can choose what pieces you want to install: tools, samples, and/or documentation (see Figure 1).
Figure 1. Install options for the .NET Framework SDK.
After that, you can choose a destination folder. This install takes a bit longer.
After everything's installed, there's one more step you should take to make things convenient for yourself. Right-click on your desktop and choose New, Shortcut from the popup menus. You'll be prompted for the location of the item you want to create a shortcut to. Enter this (including the quotation marks):
%comspec% /k "c:\program files\microsoft.net\sdk\v1.1\bin\sdkvars.bat"
Click Next and then Finish. You'll now have a shortcut on your desktop named sdkvars.bat. You'll use this later when you create your first .NET application.
Windows, Web, and Console Applications
There are three major types of applications you can create with the .NET Framework: Windows applications, Web applications, and Console applications. You can use the Visual Basic .NET language when creating any type of application. The difference is in the way you interact with the user.
Windows applications are ones that run on your computer, such as Word and Excel. Web applications are simply Web pages where you can write code to make them do things and act intelligently, rather than just presenting information. Ebay, for example, is a big Web application. A currency conversion Web page might be an example of a simpler Web application.
Finally, there are console applications. In the days before Windows, the operating system of choice was DOS and you typed in your commands as text and saw the results as text. Although DOS itself is gone for good, there is still a command line in Windows that you can use to enter commands in the same way you could with DOS. Although you wouldn't want to use it all the time, there are some tasks that can be done more easily with a command line than with Windows and mice. A console application is one that has no Windows or Web interface. It can have a simple text-based interface when you run it from a command prompt. But, console applications are most often used when you just want to do something and get it done—with little or no interaction with anyone.
In this article, I'll demonstrate VB .NET using a console application. Why? Because console applications are by far the simplest and most straightforward applications. You won't spend a lot of time learning about user interface issues—how to create windows, place controls, and so on. Instead, you'll focus specifically on learning the language. Then, once you have the language down, it'll be easy for you to go on to learn how to create Windows or Web applications.