|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Moving Items Up/Down in List Box w/VB
There is another thread in the javascript section with almost the same title, so what I am wondering is if there is a VB version of it. The thread id is
URL Any help would be greatly appreciated |
|
#2
|
|||
|
|||
|
I wrote this in just a few minutes here in class so I'm sure I missed a bug or two but you can maybe use this as a general idea. I've included a simple example if you want to see it in action.
Code:
Private Sub Add2List(ListSrc As ListBox, ListDst As ListBox)
With ListSrc
For intI = 0 To .ListCount - 1
If .Selected(intI) = True Then
ListDst.AddItem (.List(intI))
.RemoveItem (intI)
Exit For
End If
Next
End With
End Sub
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
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > Moving Items Up/Down in List Box w/VB |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|