Visual Basic 5

A quick introduction to programing in Visual Basic.

Download Visual Basic 5 from Microsoft.



Microsoft's Visual Basic programing system for Windows is a powerful application that allows you to create sophisticated programs.

Start Visual Basic 5. To begin programing select the "new" tab then "standard.EXE" from first window.
 
 

The "toolbox" (usually on the left) contains buttons, timers, text boxes, etc. 
The tool box icons represent the "controls" and "objects" used in visual basic programing.
Pointing at an icon in the toolbox displays the name of the control or object it represents.
The "form" is the gray box in the work area.

Double click on the "Command Button" icon.
A "Command Button" control will appear on the form.

Double click on the "Text Box" icon.
A "Text Box" object will appear on the form.

Each object and control has "Properties".  Properties for the Command1 button include BackColor, Caption, Font etc.

To display the "Properties" box, press F4.

Double click on "Command1".
A "Code" window appears.
Enter this line of code as shown:
text1.text = "Hello"

This code changes the "text" property of the "text1" object to "Hello"
 

Run this program by clicking the "start" button in the tool bar at the top.

Click on "Command1", "Hello" should appear in the text box.

Stop the program by clicking the "Stop" button in the tool bar.

Add a second command button, use it to create the word "Good-bye" in the text box.

Colour, or is that Color?
Note the American spelling, color, is used when referring to the property of a control or object.

Create a new project - "File" - "New Project"

Create three command buttons and a text box.
 

Colour for computer applications is commonly produced by mixing red, green and blue - RGB colour mixing.

The colour property of objects and controls can be altered by applying RGB colour mixing. Integers between 0 and 255 determine the relative quantity of a given colour.

RGB(255, 0, 0) = red

RGB(50, 200, 80) = a mix of 50 parts red, 200 parts green and 80 parts blue.

Try the code shown in the code window.

Change the caption property of the command buttons to Red, Green and Blue.

Run (start) the program, click the buttons.

Create a Colour Palette 
(Working with Scroll Bars)

Return