0
Hello wanted to know how to identify if the index (Example: 5 does not exist) and return to 0.
Follows 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 presents an error. I need that on reaching the last item (Which is variable) it returns to the first one. So an infinite loop.