How to skip errors when component is missing?

vb6 Denmark
  • 14 years ago
    Alrighty then, here we go ...

    I have a project, and I already know how to use On Error Resume Next. However, when I do this in all my subs and modules' functions and subs, some people can still get an error that shuts down the program if an ActiveX component is missing.

    How can I make a similar function of On Error Resume Next if a component is missing?





  • 14 years ago
    use Try Block ,

    Try
    Catch
    Throw exceptionParameter
    Finally
    End Try

    in Finally u can meantion what to do next after exception rise, so you can try this one
  • 14 years ago
    windows_mss wrote:
    use Try Block , Try Catch Throw exceptionParameter Finally End Try in Finally u can meantion what to do next after exception rise, so you can try this one

    Cool! Now, can you explain to me how to actually test if it works?


  • 14 years ago

    Is simple

    Try
          < your code here>
    Catch ex As Exception
          lblError.text = ex.message
          'or u can gice a friendly msg here as
          lblerror.text = "Some error has occured!"
    Finally
          conn.close
          'or any piece of code you want to run after the error or u want to it run in all the cases (it can 
          'be  your 'next statement or nect module.
    End Try









     

    Aloha

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“There's no test like production” - Anon