1 / 10

Forms

Forms. Parts of a form Form: Program User Interface Controls are contained inside forms Control event handlers are contained inside forms. Close button. Control Box. Maximize button. Minimize button. Caption. Design grid. Controls & Properties.

cachet
Download Presentation

Forms

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


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

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

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

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

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

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

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

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

  9. Unloading a Form • 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. If...Then...Else Statement • If condition Then statements [Else elsestatements ] Or, you can use the block form syntax: • If condition Then    [statements][ElseIf condition-n Then    [elseifstatements]] . . .[Else    [elsestatements]]End If

More Related