Error handling for vb6.0

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • champika anuranga
    New Member
    • Jan 2008
    • 1

    Error handling for vb6.0

    I want to insert error handler part for my new program but I don't know how to insert err.numbers for my new part. And what are the err.numbers and descriptions I can insert for this?

    My coding is.......
    Code:
    Public Function MessageShow(err As ErrObject)
        
        If [B]err.Number = -2147467259[/B] Then
            MsgBox "NO NETWORK CONNECTION"
        ElseIf [B]err.Number = 424[/B] Then
        MsgBox "A missing object in your form is needed!, Please refer to the code  and arrange accordingly!"
        elseif.......
        elseif.......
        elseif.......   ???????
    
        Else
            MsgBox err.Description
        End If
        
    End Function
    Last edited by Killer42; Jan 18 '08, 01:40 AM. Reason: Added CODE tag
  • epots9
    Recognized Expert Top Contributor
    • May 2007
    • 1352

    #2
    Moved to the Visual Basic Forums where the resident experts can better assist you.

    **Moved from Programming Challenges

    Comment

    • Killer42
      Recognized Expert Expert
      • Oct 2006
      • 8429

      #3
      Look up "trappable errors" in the documentation.

      Comment

      • debasisdas
        Recognized Expert Expert
        • Dec 2006
        • 8119

        #4
        Try to use
        [code=vb]
        On Error GoTo ErrorHandler
        ...........
        ..........
        ...........
        Exit Sub

        ErrorHandler:
        ............... ....[/code]

        Comment

        Working...