Visual Basic Week 1
Visual Basic is a programming language that allows you to create applications by placing controls on a form. Each control has a set of attributes (properties), It reacts to events in which you can write additional piece of code to improve its functionality.
The run button
The stop button
o The run button is used to start your application. o Use the stop button to halt your program
The project window
The project window contains the list of windows in your program.
The Form1 window
This is the form on which you will place controls.
The toolbox window
The toolbox provides a set of tools that you use to design your applications. These are:
Picture TextBox Label ComboBox CommandButton ListBox Timer DriveListBox DirListBox FileListBox
The properties window
Every object that you place on the form window has properties associated to it. The figure below shows the properties of the window Form1. You can change its caption (title), back colour, etc. The left column shows the properties and the right column the value of the properties.
You can set the properties of the controls at runtime. We will learn that later.
Creating your first application
Your first application will contain two items: A text box and command button. First click on the label control in the tool box window Move the pointer on the form window (Form1) Place the pointer on the upper-left corner of the desired area, Drag it down to the right until it reaches the required area. Release the mouse button.
The text box will be automatically given the name text1 as shown in the properties window. Next place a command button on the form. You screen should now look like this.
Next double-click on the command1 button. Add the line below in the code window that appears: Msgbox hello
Week 2 Creating a digital clock
Yow will need two items for this first application: A label and a timer. Place the label control and the timer control on the form window (Form1)
Change the borderstyle in label1 to fixed single Erase the caption in label1 Change the backcolor in label1 to light green Change the interval attributes in timer1 to 1000
Double Click on label1 and insert the code: Label1.caption = time