Presentation is loading. Please wait.

Presentation is loading. Please wait.

Slide 1 Forms v Parts of a form v Form: Program User Interface v Controls are contained inside forms v Control event handlers are contained inside forms.

Similar presentations


Presentation on theme: "Slide 1 Forms v Parts of a form v Form: Program User Interface v Controls are contained inside forms v Control event handlers are contained inside forms."— Presentation transcript:

1 Slide 1 Forms v Parts of a form v Form: Program User Interface v Controls are contained inside forms v Control event handlers are contained inside forms Close button Minimize button Maximize buttonControl Box Caption Design grid

2 Slide 2 Controls & Properties v Control: is an object designed to perform a specific task v Properties: are used to easily customize an object appearance v Properties of a form are saved in “.FRM” files v Form graphics and other binary elements are saved in “.FRX” files v Common properties: –Name –Index –Left –Top –Height –Width –Enabled –Visible

3 Slide 3 Controls & Properties v Object Position –Left: Horizontal distance from the left of the form –Top: Vertical distance from the top of the form v Changing properties can be at Design time and/or at Run time –Design time: through properties window –Run time: through programming

4 Slide 4 Measurements & Auto List v Measurements in VB: –Twips: device – independent unit measure = 1/20 of a printer point –1440 Twips = 1 inch v Auto List: When an object name is typed followed by a dot, VB lists all properties and events (select one using (Ctrl+Enter)

5 Slide 5 Referencing Controls & Forms v Name property: is a unique identifier by which an object can be referenced in program code. v VB Object type & Common Name Prefix: –CheckBox: chk –ComboBox: cbo –Command Button: cmd –Form: frm –ListBox: lst –Menu: mnu u For a complete list, See page 49

6 Slide 6 Methods v Methods are: –tasks that controls can perform –Program functions built into bojects –E.g. “.PrintForm” v Common Methods: –Drag –Move –SetFocus –Zorder

7 Slide 7 Events v Events are triggers that are raised by user, e.g. Click on a command button v To respond to an event a code is written (Event procedure) v Some property changes can trigger events (e.g. changing height or Width property of a form triggers the Resize event)

8 Slide 8 Displaying a Form v Single form (by default it is the StartUp form) v Select StartUp form from the project menu v Loading a form: –Load frmApplication (loading a form into memory) –Show frmApplication (Loading/Displaying a form) u Modal option: control is only for that form until closed –frmApplication.Show vbModal u Modeless option: control can be given to any part of the program

9 Slide 9 Unloading a Form v Hiding a form: –frmApplication.Hide (Not removed from the memory) –Unload frmApplication (removes it from the memory) –Unload Me (Me refers to the current object)

10 Slide 10 If...Then...Else Statement v If condition Then statements [Else elsestatements ] Or, you can use the block form syntax: v If condition Then [statements] [ElseIf condition-n Then [elseifstatements]]... [Else [elsestatements]] End If


Download ppt "Slide 1 Forms v Parts of a form v Form: Program User Interface v Controls are contained inside forms v Control event handlers are contained inside forms."

Similar presentations


Ads by Google