WizIQ helps you learn and teach online - any subject you can think of!
Join for FREE

Error Handeling

Add to Favourites
Post to:

Description
Error handeling in Visual Basic.

Comments
SunShine
By: SunShine
1071 days 9 hours 49 minutes ago

Thanks alot

Presentation Transcript Presentation Transcript

Error! Handling : Error! Handling +919810374740 (Sohit Sharma)

Inroduction : Error can be defined as the prompt shown to the programmer intimating him/her about the bugs in the code. Inroduction Presented By Sohit Sharma

Kinds of Errors! : Kinds of Errors! Syntax Errors! Runtime Errors! Logical Errors! Presented By Sohit Sharma

Syntax Errors! : Syntax errors occurs due to missing punctuation or improper use of a language element. For example, for getting to properly terminate an if…..then…..else statement. Syntax Errors! Presented By Sohit Sharma

Runtime Errors! : Runtime errors are not shown up until you execute the program. For example, if we are dividing any number by zero. Runtime Errors! Presented By Sohit Sharma

Logical Errors! : Logical errors are most difficult to locate. Logical errors occur when there is no Runtime or Syntax error. For example if we are getting the password from the user and it grants access if the password is wrong. Logical Errors! Presented By Sohit Sharma

Debugging : Debugging

Debug Toolbar : Debug Toolbar Toggle Breakpoint Step Over Step into Step Out Locals Window Immediate Window Watch Window Quick Watch Call Stack Presented By Sohit Sharma

Debugging Tools : Break Mode Breakpoints Watch Window Immediate Window Locals Window Debugging Tools Presented By Sohit Sharma

Break Mode : Break mode halts the operation of an application and gives you a snapshot of its condition. Break Mode When an application is in Break mode then we can:- Modify code in the application Observe the condition of the application’s interface. Determine which active procedures have been called. Change the values of variables. Run statements immediately. Manually control the operation of the application. Presented By Sohit Sharma

We can use Break mode in:- : Run time Design time We can use Break mode in:- Choose Break from the Run Menu. It is possible to break execution when the application is idle (When it is between processing of events). When this happens, execution stops when the next line of code is run. Choose step Into from Debug menu. Break mode will be entered at the first line of code in your application. Presented By Sohit Sharma

Breakpoints : Breakpoints let you stop program execution on any line of executable code. Breakpoints Once execution has stopped, you can use one or more of the other available tools to investigate your code. A Breakpoint stops the code that will be executed next. To set or remove a breakpoint:- Position the cursor where we want the break point, then click on the Toggle Breakpoint from the Debug menu. Toggle Breakpoint Presented By Sohit Sharma

Example : Example Presented By Sohit Sharma

Watch Window : The watch window shows the current watch expressions, which are expressions, whose values you decide to monitor as the code runs. Watch Window View Menu Watch Window Presented By Sohit Sharma

Adding a Watch Expression : From the View Menu, choose Add Watch. The current expression (if any in the code Editor will appear in the Expression box on the Add Watch dialog box. If necessary, set the scope of the variables to watch, by selecting procedure or module name. If necessary, select an option button in the Watch type group to determine how we want VB to respond to watch expression. Adding a Watch Expression Context option group Watch Type Expression Box Presented By Sohit Sharma

Example : Example Sub Command1_Click() ' Declare the variables Dim gNum As Long Dim gString As String ' Fill the variables gNum = 1 gString = Text1.Text Stop End Sub Presented By Sohit Sharma

Immediate Window : The immediate window shows information that results from debugging statements in your code, or that you request by typing commands directly into the window. NOTE: Immediate window works when the program is pause. Immediate Window View Menu Immediate Window Presented By Sohit Sharma

Example : Example Presented By Sohit Sharma

Locals Window : The Local Window shows the value of any variables within the scope of the current procedure. As the execution increases the values are also updated. With the help of this we can locate the variable and its value step by step. Locals Window View Menu Local Window Presented By Sohit Sharma

Example : Example Sub Command1_Click() ' Declare the variables Dim gNum As Long Dim gString As String ' Fill the variables gNum = 1 gString = Text1.Text Stop End Sub Presented By Sohit Sharma

Want to learn?

Sign up and browse through relevant courses.

Name:
Your Email:
Password:
Country:
Contact no.:


Area code Number
Subject you are interested in:
Word verification: (Enter the text as in image)


Sign Up Already a member? Sign In
I agree to WizIQ's User Agreement & Privacy Policy

Your Facebook Friends on WizIQ

Explore Similar Courses