Results 1 to 7 of 7

Thread: capture runtime errors, how?

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Posts
    3

    Question

    hi everybody!

    i'm developing a vb app that is distributed on a product cd that is given to all customers of a very big company. that's why this app should be safe enough that it works on all well and not-well working systems of all that customers.

    'till today we've tested the app on many computers and got most different errors from automation errors (by the way: what's that???), errors that a control (mediaplayer) used in the main form does not exist on the target system and so on...

    my Q: how can i protect my application (actually it's an intro that plays an mpeg and then starts the html product pages) by capturing occuring run time errors and continuing with starting the browser for the html product pages in this case?



    thank you VERY much for your help!!!


    matthias path

  2. #2
    Guest
    You can use Error Handling.
    Code:
    'This statement will ignore the error and continue execution of the program
    On Error Resume Next
    Code:
    'This statement will goto ERRH when an Error occurs. Form there, you can handle it however you want.
    On Error Goto ERRH
    
    '<--Code Here-->
    
    Exit Sub
    
    ERRH:
    'Handle the Error here

  3. #3
    Lively Member
    Join Date
    Jul 2000
    Posts
    104
    I was going to reply with the same thing you posted, Megatron, but it almost seemed too obvious.

    m.path,

    If you know the error codes you can handle them anyway you want to in the error handler.

    Code:
    On Error Goto ErrHandler
    
    ErrHandler:
       If Err.Number = <YOUR RUN TIME ERROR> Then
            'do whatever you want
       Else
            'do whatever
       End if

  4. #4
    Guest
    you can record the errors like this


    Code:
    Private Sub Command1_Click()
        On Error GoTo DoStuff
    
        'code code code
    
        Exit Sub
    
    DoStuff:
        Dim FF As Integer
        FF = FreeFile
        Open "c:\errlog.txt" For Append As FF
            Print #FF, "The Error " & Err.Number & "  " & Err.Description
        Close FF
    End Sub

  5. #5
    Fanatic Member steve65's Avatar
    Join Date
    Jun 2000
    Posts
    610
    For a new person starting out. What is the best way of trying to determine all the possible errors that could occur? Just handle each error as it is made know to you by testing or an end user or include all possible errors known to the vb world. If it is the later is there a listing of the most common errors and typical ways of handling them?

    Thanks
    This space for rent...

  6. #6
    Lively Member
    Join Date
    Jul 2000
    Posts
    104
    Steve65,

    About the only way is trial and error.

    Run time error lists in MSDN:
    http://msdn.microsoft.com/library/de...ableerrors.htm

  7. #7
    Fanatic Member steve65's Avatar
    Join Date
    Jun 2000
    Posts
    610
    Thanks
    This space for rent...

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