Vous êtes sur la page 1sur 21

Project Debugging

Compile

Errors: The compile time error occurs when we break the syntax rules or misspell a keyword. Use a wrong object method or property e.g if(y<x)
Msgbox(y is lesser than x)

Else
Msgbox(x is lesser than y)

Run Time Errors


If

our project halts during execution it is a run time error Run time errors can be caused by exceptions and wrong object reference E.g divide by 0

Logic Errors
With

logic errors the program runs but produce incorrect results.

Design Time
The

time during which we build an application in the IDE In the development enviornment by Adding controls ,changing property settings etc.

Break mode
The

temporary suspension of the program execution in the development enviornment. In the break mode we can examine,debug ,reset or continue program execution.

The reasons for entering a break mode


Encountering

a break point during progrtam execution. Press ctrl+break during program execution. Encounter an untrapped run time error during program execution. Add a break when watch expression is true

Step Into
Executes

one statement at a time. It executes the statements at the current execution point If the statement is a call to the procedure the next statement displayed is The first statement of the called procedure.

Step Over

Similar to step into. The difference in use occurs when the statement is a call to the procedure. Step over executes the procedures as a unit . The next statement displayed is the next statement in the current procedure regardless of the fact that the current statemnt is a call to another procedure or not.

Step out
Execute

the remaining lines of function or procedure in which the current execution point lies. then enters run time.

It

Go
Executes

the code from the current statement until a breakpoint is encountered Or the end of the program is reached.

Validation
Checking

to verify that appropriate

values have been entered as inputs to the controls is called validation.

Isnumeric function
To

check the data entered is numeric or not we use the isnumeric function. The isnumeric(x) retiurns true if the data is number else false.

Trapping Program Errors

When a run time error occurs the visual basic generates an error number And checks it against a table of error codes. We can interpret the error number and handle exception without terminating the project.

Handling exceptions using on Error statements

The on error goto specifies the label of the line where our error handling code begins. The on error resume next causes the execution to skip the line that generated the error and continue execution with the following line of code.

The On

Error Goto 0 turns off error handling.

Any error that occurs after this statement executes a run time error.

Resume Statement
Resumes

execution after an error-handling routine is finished. If the error occurred in the same procedure as the error handler, execution resumes with the statement that caused the error.

ERR object
Contains

information about run-time

errors. The properties of the Err object are set by the generator of an errorVisual Basic, an object, or the programmer.

Err Object

When a run-time error occurs, the properties of the Err object are filled with information that uniquely identifies the error and that you can use to handle the error. To generate a run-time error in your code, use the Raise method. The Err object's properties are reset to zero or zerolength strings ("") after an Exit Sub, Exit Function, Exit Property, or Resume Next statement within an errorhandling routine. You can use the Clear method to explicitly reset Err.

Raise method
Use

the Raise method rather than the Error statement to generate run-time errors for system errors and class modules.

The Err number property

Multiple forms
A

project can contain multiple forms. The multiple forms can be added from the project menu ->add form sub menu. Hide method:The hide method conceals the form from the screen. Show method :Shows the form on the screen.

Show method
There

sre two intrin\sic constants for the show method. Vbmodeless:0 Vbmodal:1

Vous aimerez peut-être aussi