Như bạn có thể thấy, một vòng lặp sử dụng Cho đến khi từ khóa là tương tự như một vòng lặp sử dụng các từ khóa Trong khi đó, ngoại trừ các điều kiện kiểm tra thường chứa các nhà điều hành ngược lại = (bằng) điều hành so với các nhà điều hành (không bằng), trong trường hợp này. Nếu sử dụng | 428 Part III Designing the User Interface The PrintPreviewDialog control displays a custom Print Preview dialog box. The PageSetupDialog control displays a custom Page Setup dialog box. As with other dialog boxes you can add these printing controls to your form by using the Toolbox or you can create them programmatically. In the following exercise you ll add Print Preview and Page Setup dialog boxes to the Print File program you ve been working with. In the completed practice files I ve named this project Print Dialogs so that you can distinguish the code of the two projects but you can add the dialog box features directly to the Print File project if you want. Add PrintPreviewDialog and PageSetupDialog controls 1. If you didn t complete the previous exercise open the Print File project from the c vb08sbs chap17 print file folder. The Print File project is the starting point for this project. 2. Display th e form and then use the Button control to add two additional buttons to the top of the form. 3. Double-click the PrintPreviewDialog control on the Printing tab of the Toolbox. A print preview dialog object is added to the component tray. 4. Double-cl ick the PageSetupDialog control on the Printing tab of the Toolbox. A page setup dialog object is added to the component tray. If the objects in the component tray obscure one another you can drag them to a better more visible location or you can right-click the component tray and select Line Up Icons. 5. Set the following properties for the button objects on the form Object Property Setting Buttonl Name btnSetup Enabled False Text Page Setup Button2 Name btnPreview Enabled False Text Print Preview Your form looks like this Chapter 17 Working with Printers 429 6. Double-click the Page Setup button btnSetup to display the btnSetup_Click event procedure in the Code Editor. 7. Type the following program code Try Load page settings and display page setup dialog box PrintPageSettings .