160 likes | 175 Views
Clearly Visual Basic: Programming with Visual Basic 2008. Chapter 16 I’m on the Inside; You’re on the Outside. Objectives. Nest repetition structures Utilize a text box’s Multiline, ReadOnly, and ScrollBars properties. One Loop within Another Loop. Repetition structures can be nested
E N D
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 16 I’m on the Inside; You’re on the Outside
Objectives • Nest repetition structures • Utilize a text box’s Multiline, ReadOnly, and ScrollBars properties Clearly Visual Basic: Programming with Visual Basic 2008
One Loop within Another Loop • Repetition structures can be nested • Programmer • Determines whether a problem’s solution requires a nested repetition structure • Figure 16-1 • Shows problem specification and algorithm from Chapter 13 Clearly Visual Basic: Programming with Visual Basic 2008
Clock Application • Clock • Uses nested repetition structures to keep track of the time • The minute hand • Controlled by the inner (nested) loop • The hour hand is controlled by the outer loop • Figure 16-3 • Shows logic used by a clock’s hour and minute hands • Figure 16-4 • Shows interface for the Clock application Clearly Visual Basic: Programming with Visual Basic 2008
Revisiting the Monthly Payment Calculator Application • Figure 16-6 • Shows the output, processing, input items, and algorithm for the Monthly Payment Calculator application • Application calculates and displays: • Monthly payments on a loan • Payments are calculated using: • Principal and term entered by the user, along with a loop that varies the annual interest rates from 4% through 7% Clearly Visual Basic: Programming with Visual Basic 2008
Revisiting the Monthly Payment Calculator Application (continued) • ScrollBars property • Indicates whether any scroll bars appear on the text box • Multiline property • Specifies whether the text can span more than one line in the control • Setting the text box’s ReadOnly property to True • Prevents the user from editing the contents of a text box Clearly Visual Basic: Programming with Visual Basic 2008
But I Want To Do It a Different Way • Use two Do…Loop statements or one For…Next statement and one Do…Loop statement Clearly Visual Basic: Programming with Visual Basic 2008
Summary • Repetition structures can be nested • For a nested repetition structure to work correctly: • It must be contained entirely within the outer repetition structure • When a text box’s Multiline property is set to True: • It can accept multiple lines of text Clearly Visual Basic: Programming with Visual Basic 2008
Summary (continued) • A text box’s ScrollBars property • Determines whether scroll bars appear on the control • Setting the text box’s ReadOnly property to True • Prevents the user from editing the contents of a text box Clearly Visual Basic: Programming with Visual Basic 2008