Hello, I want to know how to identify if the index (Example: 5 does not exist) and return to 0.
Follow my code:
Dim avancarcoordX As Integer
avancarcoordX = lbPosX.SelectedIndex + 1
lbPosX.SelectedIndex = avancarcoordX
PosX.Text = lbPosX.SelectedItem
Dim avancarcoordY As Integer
avancarcoordY = lbPosY.SelectedIndex + 1
lbPosY.SelectedIndex = avancarcoordY
PosY.Text = lbPosY.SelectedItem
When there is no Item then it has an error. I need to get back to the last item (which is variable). So an infinite loop.