• Saves Valuable Time
  • Trusted Accuracy for 12 Years
  • 15-Day Money-Back Guarantee

Java 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:

VB Java
Public Sub LegacyErrorHandling()

    On Error GoTo ErrorHandler
    '... main logic

ErrorHandler:
    '... error handling code
End Sub
public void LegacyErrorHandling()
{
    try
    {
        //... main logic
    }
    catch
    {
        //... error handling code
    }
}


Use VB to Java Converter to convert from VB to Java.     

Additional resource: VB.NET and Java Equivalents


Copyright © 1997 – 2017 Tangible Software Solutions Inc.