GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Microsoft  >  Visual Basic
Go To First  |  Previous Question  |  Next Question 
 Visual Basic  |  Question 396 of 453    Print  
How will u handle error in vb application ? explain

  
Total Answers and Comments: 3 Last Update: November 24, 2006     Asked by: pghare 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
May 30, 2006 04:08:05   #1  
Sourav Banerjee        

RE: How will u handle error in vb application ? explai...

If You want To Trap The Error In Visual Basic Code then

Write The Code In Every Procedure & Function

Public Sub xxxxx()

On Error Goto Err_xxxxx

Err_xxxxx:

if err.Number<>0 then

msgbox err.description

end if

End Sub


 
Is this answer useful? Yes | No
June 28, 2006 03:33:23   #2  
Ashishtandon.e Member Since: March 2006   Contribution: 14    

RE: How will u handle error in vb application ? explai...

it can be done in one more way like

on error goto err_handler

err_handler:

MsgBox err.number & vbcrlf & err.description & vbcrlf & err.source

err.clear

this will show u the error description


 
Is this answer useful? Yes | No
November 24, 2006 07:22:02   #3  
Jon        

RE: How will u handle error in vb application ? explai...
Simple error handling at the top level is fairly easy - Something of the formOn error goto ErrhandlerErrHandler: if err 237 then resume next ' trivial not serious else msgbox err.description end if---However if an error happens in a lower class or activex control different error handling should be used.In asynchronous classes the best solution is to raise an error event to be trapped by the higher level program however unless the higher level program is properly written this error is liable to get lost. (You can help fix this by introducing interfaces)In synchronous classes passing an error string back (by pointer possibly) and checking it at the top level is advisable for exampleRS MySQLClass(ErrorString SQL)if len(ErrorString) > 0 then ' handle the error msgbox it etc.end if
 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape