[FONT="]Hi people [/FONT]
[FONT="]I have a problem with this code, the code moves the selected item up until it gets to the top.[/FONT]
However.....
If the user accidentally presses the up button again it produces this error
Does anybody have any ideas..
Thanks People
Nick
[FONT="]I have a problem with this code, the code moves the selected item up until it gets to the top.[/FONT]
VB.NET:
Private Sub btnMoveUp_Click(ByVal sender As System.Object, ByVal e As_ System.EventArgs) Handles BtnMoveUp.Click
Dim index As Integer = LstAll.SelectedIndex
If Not LstAll.SelectedItem Is Nothing Then
LstAll.Items.Insert(index - 1, LstAll.SelectedItem)
LstAll.Items.RemoveAt(index + 1)
LstAll.SelectedIndex = index - 1
End If
End Sub
If the user accidentally presses the up button again it produces this error
An unhandled exception of type 'System.ArgumentOutOfRangeException' occurred in system.windows.forms.dll
Additional information: Specified argument was out of the range of valid values.
Does anybody have any ideas..
Thanks People
Nick
Last edited by a moderator: