Presentation is loading. Please wait.

Presentation is loading. Please wait.

Standard Grade Programming using VB 1 Programming Visual Basic.

Similar presentations


Presentation on theme: "Standard Grade Programming using VB 1 Programming Visual Basic."— Presentation transcript:

1 Standard Grade Programming using VB 1 Programming Visual Basic

2 Standard Grade Programming using VB 2 Programming This is the final evidence you require to gather for you folio. You need 2 programs at the best level you can. Aim high as a good mark for Practical Abilities can improve your overall grade!

3 Standard Grade Programming using VB 3 Lesson 1: Learning Intentions To understand that VB is a programming language To understand that a program is a list of instructions To understand that a VB project is made up of a project, a form, and controls. To understand how to run a VB program To understand how to stop a VB program running

4 Standard Grade Programming using VB 4 Visual Basic VB is a computer programming language, a High Level Language (HLL). A program is a list of instructions that cause a computer to perform a useful task, such as playing a game or writing a letter. A program can be quite small— something designed to add two numbers together, or it can be a large application, such as Microsoft Word. Staple the VB programming environment into a page in your jotter – learn it! Run the Sample project COPY!

5 Standard Grade Programming using VB 5 Lesson 2: Learning Intentions Creating and using a command button Creating and using a picture box Changing properties of a control using the properties window Writing a simple piece of VB code Saving a project in its own folder

6 Standard Grade Programming using VB 6 The Label Control A label is a control that displays information the user cannot edit. It is often used to provide titles on the screen for other controls or to explain what the program does. The label always has a 3 letter prefix of lbl followed by the name of the label eg a label to display a heading may have the name: lblHeading COPY!

7 Standard Grade Programming using VB 7 The Label Control (cont’d) Not the use of the prefix in small letters, followed by the name of the label beginning with a capital letter. Always write names of controls in this way. lblHeading COPY! Open a new project Name its form as frmName and give it the caption Name Create a label, name the label lblName Change caption to your own name Alter the alignment property Alter BackColor/ForeColour properties

8 Standard Grade Programming using VB 8 Lesson 3/4: Learning Intentions The command button

9 Standard Grade Programming using VB 9 The Command Button The command button is a Control placed on a form that when clicked runs the code behind that button. The button could cause the code to start, pause, or end an action.

10 Standard Grade Programming using VB 10 The Command Button Problem Statement We are going to write a program to make the computer beep. When the beep command button is pressed the computer should beep.

11 Standard Grade Programming using VB 11 The Command Button Design of HCI frmBeep cmdBeep Both the command button and the form have the caption Beep

12 Standard Grade Programming using VB 12 The Command Button Coding This program only needs one line of code to make it beep. The code is written between the Private Sub and End Sub lines of code eg Private Sub cmdBeep_click() Beep End Sub All commands inside the Private Sub and End Sub lines are indented! Now go to your computer and create this program. Once you have finished it complete the task on page 25 of the VB Pupil Booklet 1. (ie, adding an End and Exit button)

13 Standard Grade Programming using VB 13 Lesson 5: Learning Intentions Setting Properties in Run Mode

14 Standard Grade Programming using VB 14 Setting Properties in Run Mode When a program is running it is possible to change the properties of a label, picture box or form. To do this we need to use a line of VB programming code. The code must be in the form:- ControlName.PropertyName = PropertyValue EgfrmSample.BackColor = vbRed This code changes the background colour of form frmSample to red COPY!

15 Standard Grade Programming using VB 15 Setting Properties in Run Mode Eg if we wanted to change the background colour of the form called frmSample to red then the code would be: frmSample.BackColor = VBRed Remember: it must take the form:- ControlName.PropertyName = PropertyValue Write the line of code that would change the background colour of the label lblHeading to green: Now load the Beep program and do the task on page 24 of the booklet. Change background colour of Form to Blue and forecolour (text colour) to red.

16 Standard Grade Programming using VB 16 Setting Properties in Run Mode Eg


Download ppt "Standard Grade Programming using VB 1 Programming Visual Basic."

Similar presentations


Ads by Google