Site MapHelpFeedbackChapter Summary
Chapter Summary
(See related pages)

    1. List boxes and combo boxes hold lists of values. The three styles of combo boxes are simple combo boxes, drop-down combo boxes, and drop-down lists.
    2. The size of a list box or combo box is determined at design time. If all of the items will not fit into the box, C# automatically adds scroll bars.
    3. The values for the items in a list are stored in the Items property, which is a collection. The items can be entered in the Items property in the Proper- ties window. At run time, items are added to lists using the Items.Add or Items.Insert method.
    4. The SelectedIndex property can be used to select an item in the list or to determine which item is selected.
    5. The Items.Count property holds the number of elements in the list.
    6. The Items collection holds all elements of the list. The individual elements can be referenced by using an index.
    7. The Items.Remove and Items.RemoveAt methods remove one element from a list.
    8. The Items.Clear method may be used to clear all of the contents of a list box’s Items collection at once.
    9. Code can be written for several events of list boxes and combo boxes. Combo boxes have a TextChanged event; both combo boxes and list boxes have Enter and Leave events.
    10. A loop allows a statement or series of statements to be repeated. while/do while loops continue to execute the statements in the loop until a condi- tion is met. Each pass through a loop is called an iteration.
    11. do loops can have the condition test at the bottom of the loop and while loops test the condition at the top of the loop.
    12. A do loop can be used to locate a selected item in a combo box.
    13. A loop index controls for loops; the index is initialized to an initial value. After each iteration, the loop index is incremented. The loop is terminated when the condition is met.
    14. The PrintDocument and PrintPreviewDialog components can be used to send program output to the printer or the screen.
    15. The Print method of the PrintDialog control begins a print operation. The control’s PrintPage event fires once for each page to print. All printing logic belongs in the PrintPage event procedure. The PrintPage event con- tinues to fire as long as the HasMorePages property of the PrintDocument component has a value of true.
    16. The page to print or display is a graphics object. Use the DrawString method to send a string of text to the page, specifying X and Y coordinates for the string.
    17. Aligning columns of numbers is difficult using proportional fonts. Numbers can be right aligned by formatting the number, measuring the length of the formatted string in pixels, and subtracting the length from the right end of the column for the X coordinate.







Programming in Visual C# 2005Online Learning Center

Home > Chapter 7 > Chapter Summary