Download presentation
Presentation is loading. Please wait.
Published byCathleen Olivia Robertson Modified over 8 years ago
1
Debugger By: Engr. Faisal ur Rehman CE-105 Spring 2007
2
Types of Errors 1.Compilation Errors 2.Run Time Errors 3.Logic Errors In MSDN, write: “Know Your Bugs: Three Kinds of Programming Errors”
3
Compiler Error Compilation errors, also known as compiler errors, are errors that prevent your program from running. If the Visual Basic compiler comes across code that it does not understand, it issues a compiler error.
4
Run-Time Errors Run-time errors are errors that occur while your program runs. These typically occur when your program attempts an operation that is impossible to carry out. An example of this is division by zero. Suppose you had the following statement: Speed = Miles / Hours –(Error occurs when Hours = 0)
5
Logical Errors Logic errors are errors that prevent your program from doing what you intended it to do. Your code may compile and run without error, but the result of an operation may produce a result that you did not expect.
6
Bugs Errors are fixed through debugging No matter how carefully you design a program or write code, errors are bound to happen. Sometimes errors keep the program from even starting, sometimes they cause the program to stop running or crash, and other times, the program may run but not give the expected results.
7
Bugs Of course, when errors do occur, you will want to find them and fix them. Errors in a program are commonly known as bugs, and the process of finding them and fixing them is known as debugging. The process of debugging is iterative—that is, it is a process you will repeat over and over again. Typically you will write some code, run the program until an error occurs, find the bug, fix it, and then run the program again.
8
Bugs In most cases, you do not need to stop the program to fix it. You can fix the code where the error occurred and keep running the program where you left off; this process is called Edit and Continue. Debugging is done in the Visual Basic IDE (integrated development environment)—which contains several special commands and windows to help you find bugs. You will learn more about these in the following lessons.
9
Debugging Tools Debug Window (Debug.Write ( )) Error List (Show Errors in List) Add Watch (Expression is Added in Watch Window For Evaluation) Quick Watch (Quickly Evaluate Expression) Step Into Step Over Step Out Break Point (Causes a Program to bring into Break Mode)
10
Best Practice Use of Debug Statement.i.e., Debug.WriteLine() Use of msgbox Step Into (F8) and Step Over (Shift + F8) MSDN Procedure should not exceed dozen line Check Procedure for bugs before Writing another one Divide Your program in small projects
11
Q&A
12
Write types of bugs Tools for debugging Best practices for debugging Use of Debug Window
13
MDI Forms
14
Multiple Document interface Parent Form containing Child Forms is called MDI Form. Made by setting form property: IsMdiContainer = True
15
MDI Forms In MSDN, write: “Walkthrough: Creating an MDI Form with Menu Merging and ToolStrip Controls” “ Multiple-Document Interface (MDI) Applications” MDI form uses MenuStrip Tool
16
Modules Modules are code page without interface These are used to: Write generic and reusable sub -procedures and function On Project, Right Click > Add Module Module must contain form or control independent code so that it can be added to other projects
17
Modules Module works with console applications as well as windows application
18
Q & A
19
Define: –MDI Form –Parent Form –Child Form –MenuStrip Tool –Module –Uses of Module –Best Practice for Module
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.