I am working on two buttons(up/down) that moves the selected.items to a new index(item to the new position in the list) - with the following code it works right up until the value is -1 or greater than number of indexes in the list - obviously, so how do set parameters so it can't go lower than 0 and greater than the number of indexes in the list? So I am trying the IF statement which helps, but it does not stop the movement beyond the limits - which throws error of course. Thanks for any help.
Dim int As Integer = lsbTasks.SelectedIndex
If int = lsbTasks.Items.Count Then
btnSTDown.Enabled = False
ElseIf int <> lsbTasks.Items.Count Then
btnSTDown.Enabled = True
int = lsbTasks.SelectedIndex + 1
Dim item As String = lsbTasks.SelectedItem