tailieunhanh - Wrox’s Visual Basic 2005 Express Edition Starter Kit phần 7
Một lợi thế lớn của cửa sổ xem là không chỉ bạn có thể xem các giá trị của các biến và các đối tượng, nhưng bạn cũng có thể thay đổi chúng. Khi bạn gán một giá trị khác nhau để biến một và cho phép các chương trình để tiếp tục thực hiện, | When Things Go Wrong Figure 10-7 One great advantage of the Watch windows is that not only can you view the values of the variables and objects but you can also change them. When you assign a different value to a variable and allow the program to continue to execute it will use the new value instead of the old one thereby enabling you to change the way the program executes. In the example shown in Figure 10-7 the SubscriptionId field has a value of SubscriptionIDHere which will cause the web service method call to fail. You could put a breakpoint directly before the web service is called and replace that value with your valid SubscriptionlD and then let the program continue. At times you may want the best of both worlds the structured formatting of the Watch window and the capability to change the contents of the variables along with the temporary nature of hovering the mouse cursor over the field. This is where the Quick Watch feature comes into play. Right-clicking a field in which you are interested you can select the Quick Watch command to display a dialog window similar to the one shown in Figure 10-8 . This window enables you to navigate through the various properties of the object you re looking at changing them if needed without adding the watched variable permanently to your Watch windows. Using the Immediate Window Visual Basic Express also gives you the capability to keep tabs on your application without pausing it at every line. The Debug object has a number of properties and methods that can be used to display information about your program in the Immediate window. The most useful method of the Debug object is WriteLine. This function writes the string you specify to the Immediate window and has the default syntax of YourMessageHere . Because the parameter can be any string you can build a message much like you would for a dialog window or error display like so Successfully processed file MyFileName 209 Chapter 10 Figure
đang nạp các trang xem trước