8
Chapter 7 - Lists, loops and printing List boxes and combo boxes several types can add items at design time or during run time user select from predefined list or add new entry simple combo boxes dropdown combo boxes dropdown lists automatic scrolling

Chapter 7 - Lists, loops and printing w List boxes and combo boxes several types can add items at design time or during run time user select from predefined

Embed Size (px)

Citation preview

Page 1: Chapter 7 - Lists, loops and printing w List boxes and combo boxes several types can add items at design time or during run time user select from predefined

Chapter 7 - Lists, loops and printing

List boxes and combo boxes• several types

• can add items at design time or during run time

• user select from predefined list or add new entry• simple combo boxes• dropdown combo boxes• dropdown lists• automatic scrolling

Page 2: Chapter 7 - Lists, loops and printing w List boxes and combo boxes several types can add items at design time or during run time user select from predefined

• No caption property

• prefixes: lst and cbo

• filling the list - properties window if not change• Ctrl-Enter to add to list

• AddItem method to add during run time• value and index

• Clearing the list - clear method• ListIndex Property - select an item or determine

which item selected when running - start with 0• ListCount - number in list• ListProperty - holds all elements in list -

referenced by index• ListCount - number in list

Page 3: Chapter 7 - Lists, loops and printing w List boxes and combo boxes several types can add items at design time or during run time user select from predefined

• Removing an item from the list - RemoveItem

Do/Loops• series of statements to be repeated

• iteration - single execution

• tested at the bottom or the top• pretest - at top• posttest - at bottom

• Boolean - true or false

• Using with list box

Page 4: Chapter 7 - Lists, loops and printing w List boxes and combo boxes several types can add items at design time or during run time user select from predefined

For/Next Loops - repeats a specific number of times• loop index - controls - numeric

• Step - incremented - default = 1

• Negative increment

• Condition satisfied before loop entered

• changing values in loop

• endless loops

• exiting

Page 5: Chapter 7 - Lists, loops and printing w List boxes and combo boxes several types can add items at design time or during run time user select from predefined

MsgBox function - display dialog box• function returns value

• specifiying buttons and/or icons to display

Using String functions• Left, right, mid to return part of a string

• Len - count• SelStart and SelLength

• Selecting entries in a list box - help user

Page 6: Chapter 7 - Lists, loops and printing w List boxes and combo boxes several types can add items at design time or during run time user select from predefined

Sending to the printer• printer.print• formatting lines

• commas - print zones - 14 spaces• semicolons - right after• blank lines• tab function - column position to start• spc function - number of spaces between• aligning string and numeric data

• selecting the font - TrueType fonts• terminating page or job - NewPage

Page 7: Chapter 7 - Lists, loops and printing w List boxes and combo boxes several types can add items at design time or during run time user select from predefined

• Printing contents of list box• printing selected item from list• aligning decimal columns

Page 8: Chapter 7 - Lists, loops and printing w List boxes and combo boxes several types can add items at design time or during run time user select from predefined

Assignment #13 Pg. 319 – define key terms - pg. 281 - prog. Exer. 7.2

• name everything appropriately

• option buttons - one frame

• drop down combo - subjects

• list box – shelf number

• Print – from form – can use picture box

• OK – button - default

• help, about - message box

• loop to print subjects - 0 to (list count – 1) printer.print - Printer.EndDoc

• to pick selected item from list - pg. 271

• hand in: printed output, code, form, form as text, design on paper