VB.Net - Conversion from VB6 with GoTo
Posted on 2013-01-23
Good Day Experts!
I have run into another issue with my little conversion project from VB6 to VB.Net.
The original VB6 code is run every Friday and produces reports accurately. However, the speed is the issue and the reason for the conversion to VB.Net.
Ok, one of the routines has a select query at the top of it that returns a count. If that count is 0 then control goes to a LABEL: further down in the code. That LABEL: is inside of a DO LOOP.
After converting the code to .Net, the line of code that performs the GoTo LABEL: has an error under the LABEL: that reads --> GoTo 'DoNextClient' is not valid because 'DoNextClient' is inside a 'For' or 'For Each' statement that does not contain this statement.
The above referenced DO LOOP was converted to a FOR EACH loop which is referenced in the error.
I understand that the use of GoTo statements is not desireable. But due to time constraints and complexity of the code I am not is a position to rewrite the logic.
Do you know of a way I can recitify the error and still be able reference that LABEL: in the FOR EACH loop?
Thanks for the help,