|
-
Dec 15th, 1999, 02:06 PM
#1
I have been trying to move a list of names 1 at a time or the whole names at a go from a "listbox1" to a "Listbox2" both on the same form. This should happen whenever I click on 2 command buttons at different times. The first and second buttons have "Add" and "Add All" written on them. Any help would be much appreciated.
Thanks
Albert
-
Dec 15th, 1999, 02:59 PM
#2
Try this for moving one item (the one that is selected):
Private Sub cmdAdd_Click()
List2.Add List1.List(List1.ListIndex)
List1.Remove List1.ListIndex
End Sub
And to move them all:
Private Sub cmdAddAll()
Dim i As Integer
For i = List1.ListCount - 1 To 0 Step -1
List2.Add List1.List(i), 0
List1.Remove i
Next
End Sub
Good luck!
------------------
Joacim Andersson
[email protected]
[email protected]
www.YellowBlazer.com
-
Dec 15th, 1999, 03:05 PM
#3
Lively Member
This should work:
For the add one button:
Private Sub Command1_Click()
List2.AddItem List1
End Sub
For the add all button:
Private Sub Command2_Click()
For n = 1 To List1.ListCount
List1.ListIndex = n - 1
List2.AddItem List1
Next n
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|