Download presentation
Presentation is loading. Please wait.
1
The IDE (Integrated Development Environment) provides a DEBUGGER for locating and correcting errors in program logic (logic errors not syntax errors) The debugger is typically used to: Trace Program Control Examine Variable Values Validate Program Input and Output The debugger can only be used in IDE BREAK MODE Debugging in Visual Basic
2
Forcing a Break During the debugging process, you may want to stop at a particular location in code and watch what happens which branch of an If..Then..Else statement is executed which procedures were executed the value of a variable just before or after a calculation Force the project to break by inserting a break-point in code
3
To set a breakpoint, place the cursor in the grey margin indicator area at the left edge of the code window and click The line will be highlighted in red and a large red dot will be displayed in the margin indicator margin indicator or
4
After setting the breakpoint, start/restart program execution When the project reaches the breakpoint, it will halt, display the line at which the breakpoint is set, and go into break time To turn off a breakpoint, click on either Toggle Breakpoint or Clear All Breakpoints from the Debug Menu To turn off a breakpoint, simply click on the red dot in the grey margin indicator area alternatively
5
Using the Immediate Window The immediate window is available at design time, run time, and break time The values of data or messages can be displayed in the immediate window while the project is executing In break time, the immediate window can be used to view or change the current contents of variables or to execute lines of code At design time, view the window to see values from the previous run, but you cannot execute any code
6
Checking the Current Values of Expressions
7
Debug Toolbar Debug Menu
8
Start Step Out Toggle Breakpoint Watch Window Locals Window Break End Step Into Step Over Quick Watch Call Stack Immediate Window
9
Step Into Executes the current line. If the current line is a procedure or function call, the procedure or function code is entered Step Over Executes the current line. If the current line is a procedure or function call, the procedure or function is executed without stepping into its code Step Out Execute the remaining procedure or function code and continue stepping through the procedure or function caller’s code Run To Cursor Executes all lines of code up to the line containing the cursor Add Watch Displays the Add Watch dialog Edit Watch Displays the Edit Watch dialog Quick Watch Displays the Quick Watch dialog Toggle Breakpoint Adds or removes a breakpoint Clear All Breakpoints Removes all breakpoints Set Next Statement Allows the programmer to specify which statement within the procedure or function is executed next Show Next Statement Transfers the cursor to the next line to be executed
10
The debugging tools can help find and eliminate logic and run-time errors The debugging tools can help to follow the logic of a project to better understand how it works Debugging in Visual Basic
11
Code relating to the click events of the option buttons
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.