For i As Integer = 0 To _rows.Count
If (_rows(i).LeftOffset > largestOffset) Then
largestOffset = _rows(i).LeftOffset
End If
Next i
For i As Integer = 0 To _rows.Count
This code is never getting to the second for, I can put a breakpoint on the End If in there and it triggers for _rows.Count like it should, but then if there’s a breakpoint on the second for or anything after it it’s never reached. There’s no error message, the program doesn’t freeze or anything and it behaves exactly as if I had done:
For i As Integer = 0 To _rows.Count
If (_rows(i).LeftOffset > largestOffset) Then
largestOffset = _rows(i).LeftOffset
End If
Next i
Return
For i As Integer = 0 To _rows.Count
It should be _rows.Count-1 as the upper bound. The last time round the loop will fail with an IndexOutOfRangeException.
I have found that in a few places in VB.net, especially in Form_Load, errors are not shown up by the debugger, and the Sub just exits silently, and the program continues. A try…catch block around it will catch an exception however.