K
Kerry Hewett
Hi
I have created a list box and added a procedure which will
allow me to re-arrange the order of the list within the
box.
All is working very well. However, when I select a list
item and choose to move it up, it does not keep the
original selected item selected, but the original place in
the list!?! This is very confusing on the eye.
Does anyone have any ideas please? If you can understand
my question - well done, if you have an answer you will
become my hero. Please find a copy of the list box
movement procedure below.
Thanks very much for your time.
Kerry.
Private Sub MoveUpList(lstSrc As ListBox)
Dim intI As Integer
Dim strTemp As String
With lstSrc
For intI = 0 To .ListCount - 1
If .Selected(intI) = True And .ListIndex <> 0 Then
strTemp = .List(intI)
..RemoveItem intI
..AddItem strTemp, intI - 1
Exit For
End If
Next
End With
End Sub
Private Sub CB1_Click()
'procedure attached to my "UP" button
'seclist is the name of my listbox
Call MoveUpList(SecList)
End Sub
I have created a list box and added a procedure which will
allow me to re-arrange the order of the list within the
box.
All is working very well. However, when I select a list
item and choose to move it up, it does not keep the
original selected item selected, but the original place in
the list!?! This is very confusing on the eye.
Does anyone have any ideas please? If you can understand
my question - well done, if you have an answer you will
become my hero. Please find a copy of the list box
movement procedure below.
Thanks very much for your time.
Kerry.
Private Sub MoveUpList(lstSrc As ListBox)
Dim intI As Integer
Dim strTemp As String
With lstSrc
For intI = 0 To .ListCount - 1
If .Selected(intI) = True And .ListIndex <> 0 Then
strTemp = .List(intI)
..RemoveItem intI
..AddItem strTemp, intI - 1
Exit For
End If
Next
End With
End Sub
Private Sub CB1_Click()
'procedure attached to my "UP" button
'seclist is the name of my listbox
Call MoveUpList(SecList)
End Sub