• Saves Valuable Time
  • Trusted Accuracy since 2004
  • 15-Day Money-Back Guarantee

C# Equivalent to VB6 Error Handling

VB allows VB6-style error handling for compatibility purposes.  Some elements of VB6 error handling can be converted to try/catch blocks.  Items that cannot be converted and must be addressed via refactoring are: On Error Resume Next, Resume, Resume Next, On Error GoTo -1, and references to the Err object.

For the simplest case, the conversion is trivial:

Public Sub LegacyErrorHandling()

    On Error GoTo ErrorHandler
    '... main logic

    '... error handling code
End Sub
public void LegacyErrorHandling()
        //... main logic
        //... error handling code

Use Instant C# to convert from VB.NET to C#.     

Additional resource: VB.NET and C# Equivalents

Copyright © 2004 – 2021 Tangible Software Solutions, Inc.