tailieunhanh - Beginning Visual Basic 2005 phần 5
kích đúp vào tập tin hệ thống xử lý ổ đĩa, thư mục, tập tin và sau đó di chuyển xuống danh sách mới và kích đúp vào đọc văn bản từ một tập tin. Mã của bạn bây giờ sẽ trông như thế này, và bạn sẽ nhận thấy rằng tên tập tin được đánh dấu, cho thấy rằng đoạn mã này cần phải được thay đổi: | Chapter 9 The second watch expression that you added here will return a value of True when the intIndex variable equals 1 so Visual Studio 2005 will set the type to Boolean once you enter the For . . . Next loop. Figure 9-23 6. Step through your code line by line so that you can watch the value of the variable and expression change. Click the Step Into icon on the Debug toolbar to step to the next line of code. Keep clicking the Step Into icon to see the values of the variable and expression in the Watch window change. As you step through the loop in your code you will continue to see the value for the intlndex variable change in the Watch window. When the value of the variable in the Watch window turns color as shown in Figure 9-24 the value has just been changed. You can manually change the value anytime by entering a new value in the Value column in the Watch window. Figure 9-24 7. When you are done click the Continue icon on the Debug toolbar to let your code finish executing. Then stop your project once the form has been displayed. Debugging with the Locals Window The Locals window is similar to the Watch window except that it shows all variables and objects for the current function or procedure. The Locals window also lets you change the value of a variable or object and the same rules that apply to the Watch window apply here that is the program must be paused before a value can be changed . The text for a value that has just changed also turns red making it easy to spot the variable or object that has just changed. The Locals window is great if you want a quick glance at everything that is going on in a function or procedure but it is not very useful for watching the values of one or two variables or expressions. The reason for this is that the Locals window contains all variables and objects in a procedure or function. Therefore if you have a lot of variables and objects you will have to scroll through the window constantly to view the various variables .
đang nạp các trang xem trước