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 (with VB6 error handling):
Public Sub ErrorHandlingExample()
On Error GoTo ErrorHandler
'... <main logic>
'... <error handling code>
public void ErrorHandlingExample()
// On Error GoTo ErrorHandler
//... <main logic>
//... <error handling code>
If you need to convert from VB to Java and you are depending on the results being reliable and accurate, then you will want to have VB to Java Converter, the best VB to Java converter, at your fingertips.