If I put empty catch blocks for my C# code, is it going to be an equivalent for VB.NET\'s \"On Error Resume Next\" statement.
try
{
C# code;
}
catch(excepti
You need to analyze the On Error Resume Next
statements one by one and see what their purpose is. Some may be just sloppy code, but there are valid reasons for On Error Resume Next
in Visual Basic 6.0 code.
Some examples of why to use On Error Resume Next
in Visual Basic 6.0 code:
To check if a given key exists in a Visual Basic 6.0 collection. The only way to do this is to access the element by key, and handle the error that is raised if the key does not exist. When converting to .NET, you can replace this by a check for the existence of the key.
Parsing a string to an integer. In .NET you can use TryParse.