Visual Basic 5.0
When an organisation or an individual needs to have a customised software for :
a programming language is used, and Visual Basic 5 (VB5) is an easy programming language to handle.
I intend to introduce VB to those who are just emberking on the programming language. There is a program I created which will introduce new users slowly to the options in VB environment. I asume you have the VB 5 software available to be able to follow along.
When starting VB 5, there will be an option initially of standard EXE, Active EXE, Active DLL, ActiveX Control, VB Application Wizard, ADDIN, ActiveX Document DLL and ActiveX Document EXE.
Step 1. Select standard EXE.
You will be presented with a new screen, for the moment we are only interested in the form box called (Form1) and tool box called (General).
Pointer Tool
Label, displays text which users cannot modify
Text, displays text which users can edit/modify
Command button, Enables users to activate specific function.
The following box on the right indicates the status of any tools which are used in your form. It is called the Property Window.
As can be seen, the first property of the form is (Name), which can be defined to indicate a sensible name for the form. Use names without separation. Change the property to Mainform.
Caption property, is the displayed text when the form is activated. Change this to My first form.
Scroll downward till StartUpPosition, click and find an arrow indicating a few options. Some of the property will have preset options such as this. Change this to 2-Center Screen.
All the above instruction can be summarised as follows;
Properties - Form1 |
Description |
(Name) |
Mainform |
Caption |
My First Form |
StartUpPosition |
2-Centre Screen |
Double Click on Tool option [LABEL], you will find a square box on your form being highlighted. The Property Window will now have the property of the Label. Using the same method as earlier change the Properties for the label.
Properties - Label1 |
Description |
Caption |
Enter Your Name: |
Left |
120 |
Width |
1440 |
Double click again on the Tool box option [LABEL]. Change its property.
Properties - Label2 |
Description |
Caption |
(leave blank) |
Left |
120 |
Height |
495 |
Width |
4335 |
Font |
Ms Sans Serif, size14 |
Double click on Tool box option [Text]. Change its property.
Properties - Text1 |
Description |
Text |
(leave blank) |
Left |
1560 |
Width |
600 |
Double Click on Tool box option [Command Button]. Change its property.
Properties - Command1 |
Description |
(Name) |
CmdQuit |
Caption |
Quit |
Left |
495 |
Height |
3360 |
Width |
1215 |
Double click on the Text1 box, the window will change to display the code. Change the event box to Change (see diagram below) . And add the following into the code.
Private Sub Text1_Change()
Label2.Caption = "Hello " & Text1.Text & " !"
End Sub
We are now ready to make our program go into action. Click on the PLAY button.
Watch your first program go into action and play around with it until you can understand it better.
I hope you enjoyed your first Visual Basic 5 program. Any problem occur is unintentional, please mail me the problem and I will fix it into this page.