Results 1 to 3 of 3

Thread: Global Error Handlers

  1. #1

    Thread Starter
    Lively Member Daniel McCool's Avatar
    Join Date
    Oct 2002
    Posts
    127

    Global Error Handlers

    Are there any means of handling errors globally? Also, how do I determine what kind of error the error is.

    I would like to have my application detect an error, then message the user that there is an error, save the users work, then close the application.

    Handling the errors globally would make this much simpler and efficient. Thanks fallas.
    "Some love is fire, some love is rust. But the finest, cleanest love is lust." - James Bond

  2. #2
    Good Ol' Platypus Sastraxi's Avatar
    Join Date
    Jan 2000
    Location
    Ontario, Canada
    Posts
    5,134
    I think if you used a Sub Main() style thing, with this:
    VB Code:
    1. Public bExit As Boolean 'Form1 sets this to true when they want to quit!
    2. Public bError As Boolean 'Form1 sets this to true when there's an error!
    3. Public Sub Main()
    4.     Form1.Show
    5.     Do
    6.         DoEvents
    7.     Loop Until bExit = True Or bError = True
    8.     If bExit Then
    9.         End
    10.     Else
    11.         Msgbox "There has been an error......"
    12.         ...
    13.     End If
    14. End Sub
    Or maybe just having error handling in the form_main event would do; Seeing as not specifying LOCAL in the On Error statement makes it react to Subroutine calls erroring out, it (MIGHT) do the same. I don't think so though!...

    There is probably a really easy solution, I don't know what it is, if it exists.
    All contents of the above post that aren't somebody elses are mine, not the property of some media corporation.
    (Just a heads-up)

  3. #3
    The Devil crptcblade's Avatar
    Join Date
    Aug 2000
    Location
    Quetzalshacatenango
    Posts
    9,091
    #1 Nope. error handling must be done on a procedure by procedure basis.

    #2 Use the Err object to get the error number, description, etc.


    Laugh, and the world laughs with you. Cry, and you just water down your vodka.


    Take credit, not responsibility

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width