60 likes | 190 Views
Chapter 5 - Menus, Sub Procedures, and Sub Functions. Menus - controls - properties and events menu editor - create and change defining menus - menu commands, submenus, keyboard access keys caption and name required mnu - levels of menu separator bars coding - click event
E N D
Chapter 5 - Menus, Sub Procedures, and Sub Functions • Menus - controls - properties and events • menu editor - create and change • defining menus - menu commands, submenus, keyboard access keys • caption and name required • mnu - levels of menu • separator bars • coding - click event • toggling check marks • standards
Common dialog boxes - windows environment - predefined • using • writing general procedures - sub procedures or functions - reusable • subprocedure - performs function • function - returns a value • large sections of code broken down into smaller sections • Tools/add - not an event - called
passing variables - keep scope as narrow as possible • byval and byref • Functions • predefined • user-defined - arguments • multiple arguments • Executable files
#10 - Pg. 203, 5.3 • Input sales, person name, and weekly sales, calculate commission – function – pg. 189, display pay – commission and total pay – if no commission – do not display $0 commission, about moved over, access keys, summary – total sales commission, pay – format number, 2 – no $ - in message box, module and local variables, constants in function, skip font menu, color – must make show – generate common dialog control, name – affect forecolor; design, code, form, form as text, output with summary – printscreen, message box string – joining several together – pg. 140, clear – reset focus, Sandy - $400, Sam - $250, Joe - $550 • pg. 240, rev. questions 1-7
5.3 • Function – sales – local variable • Constants for commission rate and quota • If sales > quota • Commission = sales * rate • Display commission • Add to module variable • Else • Commission = $0 • Commission not display • End if • Pay • Local variables – pay, sales, constant – base pay • Enter sales • Check if not 0 • Calculate pay with function – sales sent • Display pay • Add to total pay and sales • Summary • Display summary info in message box • Clear • Clear text boxes and labels, set focus • Color – common dialog box, label = color chosen