VB.Net ListBox selected item up down with button

    'Move up
    Private Sub btnUp_Click(ByVal sender As System.ObjectByVal e As System.EventArgsHandles btnUp.Click
        With Me.ListBox1
            If .SelectedItem Is Nothing Then Exit Sub
 
            'Make sure our item is not the first one on the list.
            If .SelectedIndex > 0 Then
                Dim I = .SelectedIndex - 1
                .Items.Insert(I, .SelectedItem)
                .Items.RemoveAt(.SelectedIndex)
                .SelectedIndex = I
            End If
        End With
    End Sub
 
    'Move down
    Private Sub btnDown_Click(ByVal sender As System.ObjectByVal e As System.EventArgsHandles btnDown.Click
        With Me.ListBox1
 
            If .SelectedItem Is Nothing Then Exit Sub
 
            'Make sure our item is not the last one on the list.
            If .SelectedIndex < .Items.Count - 1 Then
                'Insert places items above the index you supply, since we want
                'to move it down the list we have to do + 2
                Dim I = .SelectedIndex + 2
                .Items.Insert(I, .SelectedItem)
                .Items.RemoveAt(.SelectedIndex)
                .SelectedIndex = I - 1
            End If
        End With
    End Sub