avadhutd2
11-09-2009, 12:22 AM
Hi,
I need help regarding the code below. This code moves the selected item in the listbox UP in the list. Actually, the listbox that I am working on is a 2 column listbox. Hence I have 2 values corresponding to a item in a listbox.
e.g ListBox may look like something like -
http://www.dicks-blog.com/blogpix/ReOrderLb1.gif
What modification can be done in the code below so that I can move both columns of the selected item UP in a column wise format.
Dim intCurrentIndex As Integer
Dim strCurrentText As String
With ListBox1
If .ListIndex > 0 Then
intCurrentIndex = .ListIndex
strCurrentText = .List(.ListIndex)
.RemoveItem .ListIndex
.AddItem strCurrentText, intCurrentIndex - 1
.ListIndex = intCurrentIndex - 1
.Selected(intCurrentIndex) = False
.Selected(intCurrentIndex - 1) = True
End If
End With
Please let me know....Thanks!
I need help regarding the code below. This code moves the selected item in the listbox UP in the list. Actually, the listbox that I am working on is a 2 column listbox. Hence I have 2 values corresponding to a item in a listbox.
e.g ListBox may look like something like -
http://www.dicks-blog.com/blogpix/ReOrderLb1.gif
What modification can be done in the code below so that I can move both columns of the selected item UP in a column wise format.
Dim intCurrentIndex As Integer
Dim strCurrentText As String
With ListBox1
If .ListIndex > 0 Then
intCurrentIndex = .ListIndex
strCurrentText = .List(.ListIndex)
.RemoveItem .ListIndex
.AddItem strCurrentText, intCurrentIndex - 1
.ListIndex = intCurrentIndex - 1
.Selected(intCurrentIndex) = False
.Selected(intCurrentIndex - 1) = True
End If
End With
Please let me know....Thanks!