Visual Basic was invented by Microsoft based on an earlier language known as BASIC, which was developed by Dartmouth College professors in the 1960s. The very first version of BASIC created by Bill Gates and Paul Allen in 1975 is considered the first personal computer programming language.
The first version of Visual Basic came out in 1991 and it revolutionized the programming industry because it allowed everyone to create Windows programs easily and quickly. Prior to the release of Visual Basic, Windows programs were typically written in C++ and it was a difficult task for even experienced programmers. If you have no programming experience at all, Programming Fundamentals for Non-Programmers gives you a solid lesson in programming logic applicable to Visual Basic as well as most other modern languages.
In more recent times, Visual Basic has evolved into the .NET framework, which also includes a version of C++ and C #. The .NET framework does most of the work while Visual Basic and every other .NET language is just a skin on top of the framework. You can learn more about C# in .NET Programming for Beginners.
All these programming languages can be managed from a single IDE (Interactive Development Environment) known as Visual Studio. You will be using Visual Studio to create programs in Visual Basic. Specifically, you can use Visual Basic 2010 Express Edition which is completely free to use and you are unlikely to outgrow the Express version anytime in the near future.
Getting Started with Visual Basic
The first thing you need to do is download Visual Basic Express from the Microsoft website. Make sure your computer meets the minimum hardware requirements (it should if you purchased it in the last 3 – 4 years). Express will install automatically and your development environment is now ready to go.
Traditionally, the very first program you write in any programming language is known as “Hello World.” There’s no sense in breaking tradition now, so the next section will teach you how to create your very first program using Visual Basic Express.
Start Visual Basic Express and select a new project from the file menu at the top left of the screen. A small dialog box will appear and you need to select the Windows Application template. Although the default name for this new project is WindowsApplication1, you want to rename it to HelloWorld. Remember that you should name each of your applications appropriately so that you know exactly what it is when you start working on multiple projects simultaneously.
The IDE will automatically create a complete starter program ready for you to add code and objects. Every object will have multiple properties. Even the Form that is sitting in your newly created project has an entire properties window that can be fully customized as you become more familiar with Visual Basic.
Now it’s time to add controls to your program. Controls are objects that perform actions within the project. These controls are located in the Toolbox which can be found on the left side of your screen. Adding a control to your program is easy. Simply drag it where you want it on the Form and let it go. Once they’ve been added to your program, you can also resize these controls and change their properties.
For the Hello World program, you need two controls. Drag a Button and a Label onto the form. You can position them wherever you would like and change their names if you want to. In the properties of the button, change the text of the button to read “Display Hello.”
The only thing left to do is to add the code that will actually display “Hello World!” in the Label when the button is clicked. The easiest way to find the Code Window (where you actually write code for your application) is to simply double-click on the Button control. Visual Basic Express will automatically bring you to the code window for that particular button.
Notice that some of the code has already been created for you. Literally, all you have to do is add code to the subroutine of the Button to display text and you are done.
Your Code Window should now have the following code:
Public Class HelloForm
Private Sub btnDisplayHello_Click(
ByVal sender As System.Object,
ByVal e As System.EventArgs
) Handles btnDisplayHello.Click
lblHelloWorld.Text = “Hello World”
With your program completed, the next thing to do is try it out. To run a program in Visual Basic Express, click the Start Debugging icon in the toolbar or simply press F5. Click the “Display Hello” button and “Hello World!” is displayed in the Label.
That’s it! You just created your first program using Visual Basic. But there is a lot more you can learn from this simple Hello World program. Try changing the Font property to see how different font types render in Visual Basic. You can also add a Textbox (another control) to the Form and add code that will transfer text you enter into the Textbox to the Label.
You can even try to make the program change the title of the Form when the Button is clicked instead of putting the text into the Label. As you experiment with various configurations, you will be learning new techniques which you can apply to much more advanced programs as you progress.
The next step is to apply your knowledge to useful tasks. Visual Basic for Applications (VBA) lets you automate tasks in other Windows programs such as Excel using Visual Basic coding. You can learn how to do this in VBA & Macros: Part 1.
Visual Basic has a huge online following and there is ample information available at your fingertips when you get stuck. If you don’t know how to code something, simply look it up as there are probably hundreds of others who have asked the same or a similar question. In addition, the Help section within Visual Basic Express is very useful for understanding basic and advanced techniques that you may not be familiar with already.
It won’t be long before you are creating useful Windows applications for your PC and maybe even for family and friends. After that, who knows! Microsoft is always looking for good programmers – maybe even you. You could also start your own programming business. Break into the Programming Business shows you how to get started, even if this is your first time programming.