tailieunhanh - Beginning microsoft Visual Basic 2010 phần 6

Trong hộp công cụ, di chuyển xuống cho đến khi bạn thấy sự kiểm soát SaveFileDialog và sau đó kéo và thả nó vào biểu mẫu của bạn. Kiểm soát sẽ được thêm vào dưới cùng của vùng làm việc trong IDE. Double-click nút Save để đưa ra sự kiện Click của nó và thêm đoạn mã in đậm: | 326 I CHAPTER 10 DEBUGGING AND ERROR HANDLING 1. Stop your project and set a breakpoint in the For loop as shown in Figure 10-18. Remember that to set a breakpoint you need to click in the gray margin on the line of code where the breakpoint should be. FIGURE 10-18 2. Start your project again by clicking the Start icon on the toolbar. . 3. In the Breakpoints window right-click the second breakpoint and choose Hit Count from the context menu to invoke the Breakpoint Hit Count dialog box. 4. The breakpoint that you currently have set halts execution every time it is encountered. Change it to break only when the loop enters its third execution. You do this by selecting the option break when the hit count is equal to in the drop-down list and then entering the number 3 in the text box displayed next to it as shown in Figure 10-19. Click the OK button to close this dialog box. Notice the Hit Count column in the Breakpoints window in the IDE. The second breakpoint now displays the Hit Count condition that you just defined. The red circle will now have a white plus in the center of it for this breakpoint. 5. At this point click the Start button on the form. By clicking the Start button you are again stopped at your first breakpoint. 6. This breakpoint is highlighted in the Breakpoints window. You no longer need this breakpoint so click it and then click the Delete icon in the Breakpoints window the breakpoint will be deleted. Your code is still paused at this point so click the Continue button on the Debug toolbar. 7. You are now stopped at your breakpoint in the For loop as it enters its third execution. Notice that the Breakpoints window shows both the hit count criteria that you selected and the current hit count. As you can see this is a handy way to have a loop execute a definite number of iterations before breaking at a defined breakpoint. 8. Now let your code continue executing by clicking the Continue button on the Debug toolbar. 9. Stop your project once the form

crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.