Debugging

Break Mode

Break mode pauses the execution of any code, and allows you to edit it. In break mode properties and values are held so that you can analyes thier current state. Break mode can be reached by either:

1) Selecting Break from the Run menu (Ctrl+Break) or pressing the button (Pause Button)

2) Visual Basic reaching a Stop statement in your code.

3) Visual Basic reaching a Break Point

When debugging you might want the code to halt at a problem statement where you think the problem may have started. Visual Basic provides breakpoints and Stop statements for this. Breakpoints pauses Visual Basic, the cursor is moved to the break point and is highlighted in yellow. You can then check values of variables, use the immediate pane (see below) and edit code. The same thing occurs if Visual Basic reaches the Stop statement. To create a breakpoint, simply left-click in the light grey area to the left of your code, or press the button. The current line of code will then be highlighted in red, and made bold. To remove the break point simply do click in the grey area again, or press the breakpoint button.

To check the value of a variable or constant, you can use some of the methods described in the next few sections. You can also just leave the mouse cursor over the variable or constant and after a few seconds a tooltip will appear giving the value:


Tooltip

To continue code execution, simply press the Play button, or press F5.

You might also like...

Comments

About the author

James Crowley

James Crowley United Kingdom

James first started this website when learning Visual Basic back in 1999 whilst studying his GCSEs. The site grew steadily over the years while being run as a hobby - to a regular monthly audien...

Interested in writing for us? Find out more.

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Owning a computer without programming is like having a kitchen and using only the microwave oven” - Charles Petzold