VB .Net

Debugging Tools

[Display a Value of an Object] [Built-in the Debugging Tool]

To find out what is going on inside of the program, you can use a different tools.

Display a Value of an Object to Isolate an Error

  1. Add a TextBox in the GUI to display the value. You may name it as Debug1 as shown below. (Once the debugging is completed, delete it.)


  2. Add a code right next to where you suspect the problem is located. To confirm your hypothesis, add a code that displays the current value of the object (variable or control) to Debug1 TextBox. For example, you suspect sngSalesAmt may be linked to an error. Your code could be: Debug1.Text = sngSalesAmt. It is show below.

  3. Run the program. You will see the current value of txtSalesAmt in the Debug1 TextBox. If the program "supposed" to show other value than what is shows, then you know the problem is before the debugging code. That information should assist you to isolate the error. In the example, if the current value supposed to be other than 2, then you know the error is before the debugging code. To narrow the search for the problem, move the debugging code up a few codes, then run the program again.

 

Using the Built-in Debugging Tool

  1. Using the mouse pointer, click on the gray bar next to the code you want to start the debugging process. Then click on the gray bar next to the code where you want to stop the process. The first bullet indicates the starting position while the second bullet indicates the ending position of the debugging process.


  2. Run the program. You will notice that the program runs as usual up to the point where you inserted the first debug bullet.


  3. From there, press F11 for Step Into.



    In this way, you can see exactly what happens code by code.
  4. Press F11 until the end of the debugging process. The program will resume the "normal" process after the ending point of the debugging point.