こんな感じかと思います
----------------------------------------------------------------
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'選択項目を下げる
Dim pos As Integer, repPos As Integer
Dim wk As String
pos = ListBox1.SelectedIndex()
If pos <> -1 And pos < ListBox1.Items.Count - 1 Then
repPos = pos + 1
wk = ListBox1.Items.Item(repPos)
ListBox1.Items.Item(repPos) = ListBox1.Items.Item(pos)
ListBox1.Items.Item(pos) = wk
ListBox1.SelectedIndex = repPos
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
'選択項目を上げる
Dim pos As Integer, repPos As Integer
Dim wk As String
pos = ListBox1.SelectedIndex()
If pos > 0 Then
repPos = pos - 1
wk = ListBox1.Items.Item(repPos)
ListBox1.Items.Item(repPos) = ListBox1.Items.Item(pos)
ListBox1.Items.Item(pos) = wk
ListBox1.SelectedIndex = repPos
End If
End Sub
投稿日時 - 2006-04-29 13:37:04