3.9 to 3.15. also refer to as program contains set of instructions that tells the computer how to...

Post on 05-Jan-2016

212 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

3.9 to 3.15

Also refer to as Program Contains set of instructions that tells the computer

how to perform specific task. Each line of code is referred to as a statement.

Is a block of code that executes in response to an event. Event (User Event) – is a way in which the user can

interact with an object, such as clicking a button. Specific actions will be taken when the user clicks on the

button.

Container for program code. Code Editor – is the area displaying the form module

View Code button View Object button

Display by double-clicking on the form. Display by clicking on the View Code Button in the

Project Explorer. Clicking the button beside the view

code button returns you back to the form.

Removes a form from memory and ends the application.

Unload statement requires a form name to be unloaded.

If the form to be unloaded is the current form, then you could use Me

Select object name from Object list and then a corresponding event is selected from the Event name.

Indicates that the procedure cannot be accessed outside of the form module.

Sub declares the procedures End Sub – ends the Sub statement. Body is between Sub and End Sub statements.

The interface and program code of an application are printed by selecting the print command from the file menu

CTRL + P

File menu – Select the Remove Project command.

Assignment – is used to change the value of an object property at run time.

Assignment Statement changes property values using the equal sign.

Each Object property can only be assigned a valid property values.

Is displayed when typing an object’s name and a dot notation mark.

Name – Cannot be change during run time by an assignment statement

Caption – Text in double Quote• lblMessage.Caption = “Adios”

Font – has several Subproperties• Size – 0 – 2048

Example: lblMessage.Font.Size = 10• Bold & Italic are True or False

Example: lblMessage.Font.Bold = True• Name – enclosed in double quote

lblMessage.Font.Name = “Arial” Alignment – 0-left, 1 – right, 2 – center

Name – can not be changed during run-time through the assignment statement.

Caption – Can assigned text using double quotes. • Example: cmdCancelorDone.Caption = “Done”.

Name – can not be changed during run-time through the assignment statement.

Caption – Can be assigned text using double quotes. • Example: frmUserApp.Caption = “My Application”

Event procedures can also be written for form events. The Form_Load event procedure is executed when the

form is loaded into memory.(Application is started) Examples

Private Sub Form_Load()lblSample.Caption = “This text is centered.”lblSample.Alignment = 2End Sub

Changing object property values in the Form_Load event procedure is alternative to setting property values in the Properties window.

Initializing the form – Setting object properties through the Form_Load event.

Comments – are used to explain and clarify program code for a human reader.

No effect on how the application runs. Single quotation mark (‘) begins a comment Mark code that is ambiguous or misleading. Example: lblSample.Alignment = 0 ‘left justify

File menu – Open Project CTRL + O Open Project Button on the Tool Bar

top related