The programming language called BASIC (Beginners' All-purpose Symbolic Instruction Code) was born in the U.S. in 1961. Since then it has evolved into a powerful language used by professional programmers all over the world while maintaining its attractiveness to beginners as a relatively easy-to-learn language.
'Visual' Basic first appeared in 1991 - it is called 'visual' because some of the 'programming' can be done by drawing rather than by writing code.
In 2001 a new family of Visual Basic versions came into being: VB.NET. This new family is not compatible with the previous versions 1-6, but the '6 steps' in making a program are the same for both families.
Visual Basic is a 'high level' programming language meaning it is a lot like English and less like the language that the computer uses internally, called machine code. An example of a 'low level' language is the language called C - since C is closer to machine code it is harder to write but can sometimes be more efficient. Visual Basic used to be slower than C but it has improved so much that there is no longer much difference in speed. Recently another language has become popular, called Java. Java has the advantage that programs written in Java can run on different types of computer (e.g. PCs and Macs) with little or no modification - this also means that Java programs can easily be incorporated into web pages. Programs running inside a web page are called 'applets'.
The basic steps in the creation of a Visual Basic program are these:
- define the problem and plan the solution
- add the controls to the form(s)
- set the properties for the controls
- write the code (the instructions that make up the program)
- test and debug the program
- convert the program to an 'EXE' file that can be run independently of Visual Basic, and which thus be distributed to users who do not possess VB
Follow these links for more on these various steps. It is rather unfortunate that step 4, the writing of code, does not come earlier, for the code is the heart of any program and the design of the interface should follow the workings of the code, rather than the other way around. That is why it is important not to rush the first step - it is a common mistake to rush straight into the creation of the controls without having a clear idea how the program will work. Also, you will soon realize that writing code is harder than creating controls, so there will be a temptation for you to spend too much time making a nice-looking form while spending too little time working on the code. That would be like building a car that looks beautiful on the outside but doesn't actually go anywhere for it has no engine!
When you start Visual Basic, you will see a complex collection of windows - let's look at each part one by one. The images on these '6 step' pages come from versions 5 or 6 of VB but VB.NET versions are similar - almost all you see here is valid in VB.NET.
At the top of the screen are the menus and the toolbar:
The Form Window is central to developing Visual Basic applications. It is where you draw your application:
The Toolbox is the selection menu for controls used in your application:
Don't confuse the toolbox at the left with the toolbar at the top! Note that the data tool is not available in the version of VB that we will be using in class.
The Properties Window is used to establish initial property values for objects. The drop-down box at the top of the window lists all objects in the current form. Two views are available: Alphabetic and Categorized. Under this box are the available properties for the currently selected object:
The Form Layout Window may be visible - it shows where your form will be displayed relative to your monitor’s screen when you run the program:
The Form Layout Window is not very useful so I suggest you close it to make more room for the properties window.
The Project Explorer (called the Solution Explorer in VB.NET) displays a list of all forms and modules making up your application. You can also use the Project Explorer to display the Form or Code windows (window containing the actual Basic coding) using the icons at the top.
The Code Window opens whenever you double-click a form or any control within a form. You can also open the code window by clicking the corresponding icon in the project window.
Now follow the links at the top of this page to learn more about creating a VB program.