Error Handeling in vb 6.0 Code RRS feed

  • Question


    hi dear,


    i want to know that how can i handel errors in vb 6.0 code?

    please reply asap.

    Wednesday, October 17, 2007 7:50 AM

All replies


    hi dear,


    by using vb 6.0 i need to deploy my Product application at client side but i am not able to manage process in a proper flow means as user click on install my application will display the exe file and start another task,i want that it should wait to finish first process.


    please help me for same.


    Wednesday, October 17, 2007 7:54 AM
  • Try this one...
    "On Error Resume Next"
    Friday, October 19, 2007 9:52 AM
  • You can handle in 3 ways:

    1. On Error GoTo <GoToLabel>
    2. On Error Resume Next
    3. On Error GoTo 0 (moves the error handler up the stack)

    Also, each time an error occurs, VB6 automatically generates an "err" object which contains information about the error. You can explore the properties of the error object yourself, too much to explain.


    As a side note: VB6 is seriously outdated now. VB.NET is the evolved version (we are at VB8 atm). Might want to consider switching to the .NET platform?

    Friday, October 19, 2007 12:07 PM
  • For error object, use this one..


    4. On Error GoTo err


    err is an object through which you can handle the exception according to the type of error occured.


    err.number would give you the error number of the error in concern.


    To realize a bit better what you can possibly do with your own version of error handling, as opposed of relying solely on Visual Basic's internal functionality, we'd better have a look at the different parts of the error object it self.


    Required properties

    Optional properties

    About the event properties

    Err.Clear is called solely to clear the most recent error from the error structure. In the event you fail to clear the error, it would persist and be called again, especially in longer functions where you may resume the function at an earlier point than simply to exit the functions or sub running. Failing to clear the event would also cause the error to persist cross modules if occurring in a function of the public or global scope.

    Friday, October 19, 2007 6:39 PM