Welcome to Dream.In.Code
Getting VB Help is Easy!

Join 86,240 VB Programmers. There are 2,286 online right now! Ask your question and get quick answers from Dream.In.Code experts. Join the #1 programming help community on the internet! Registration is fast and FREE... Join Now!

Chat LIVE With a VB Expert
Powered by LivePerson.com

Register to Make This Box Go Away!

Move items between Listboxes

 
Reply to this topicStart new topic

Move items between Listboxes

AjayRaveendranath
post 7 May, 2008 - 07:11 AM
Post #1


New D.I.C Head

*
Joined: 7 May, 2008
Posts: 1



i have 2 list boxes, i need to move the selected items from listbox1 to listbox2. The problem i have is i need to remove the item from the first listbox and reverse
User is offlineProfile CardPM
Go to the top of the page
+Quote Post


sam_benne
post 7 May, 2008 - 08:17 AM
Post #2


D.I.C Head

Group Icon
Joined: 16 Jan, 2008
Posts: 144

Have you tried using arrays
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

lakhanmahajan
post 8 May, 2008 - 10:32 AM
Post #3


New D.I.C Head

*
Joined: 4 May, 2008
Posts: 13

QUOTE(AjayRaveendranath @ 7 May, 2008 - 07:11 AM) *

i have 2 list boxes, i need to move the selected items from listbox1 to listbox2. The problem i have is i need to remove the item from the first listbox and reverse


code for to add the selected item of 1 to 2 is
vb
sub add()
For i = 0 To List2.ListCount - 1
If List2.Selected(i) = True Then
List1.AddItem List2.List(i)
End If
Next
end sub
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

born2c0de
post 10 May, 2008 - 12:16 AM
Post #4


printf("I'm a %XR",195936478);

Group Icon
Joined: 26 Nov, 2004
Posts: 3,298

Your code does not remove the item from the list.
Use list1.RemoveItem i inside the IF construct.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 5/16/08 08:13AM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month