Delete Single item from multi select listbox

A

Asib

Afternoon all. I have searched far and wide for a solution to this. I have an
unbound multi select listbox that i populate with a double click event from a
list of items. I can add things just fine. I can also delete all the items
that i have added to the list box. What i need help on is deleteing a single
item from the listbox on doubleclick. If its easier to simply create a button
that loops through the selected items and deltes them i can do that. But
double clicking seems easier for the users.

lstSelectedItems.RemoveItem (i) This code deletes the first item in the
list. I just need to reference only the item i am double clicking.

Thanks Aasibs.
 
D

Daniel Pineault

See http://msdn.microsoft.com/en-us/library/aa221565(office.11).aspx
You simply pass the list box control name and the item number to delete.

Another post that covers the subject can be found at
http://www.bigresource.com/Tracker/Track-vb-Rt80BCvIGM/

Yet another post on the subject can be found at
http://news.office-watch.com/t/n.aspx?articleid=978&zoneid=30
--
Hope this helps,

Daniel Pineault
http://www.cardaconsultants.com/
For Access Tips and Examples: http://www.devhut.net
Please rate this post using the vote buttons if it was helpful.
 
A

Asib

2 of the links you posted i had already come across. The first microsoft
article i tried to implement, but was unsuccessful because it needs the index
number. I do this in what litle spare time i have and still consider myself a
novice at best. Can i build a string in the double click event of the listbox
to determine the index and then use the function to remove the item? The
second artical drifted off to something that doesnt pertain to my current
situation. And the third i found too indecipherable to do me any good. It was
all based on command buttons and i wasnt sure if the same logic can be
applied to the double click event. Thanks for takin the time to try and help.
 
A

Asib

Disregard the last post. I figured it out. I used this to delete a single
item from the list box.

Call RemoveListItem(lstSelectedItems, lstSelectedItems.ListIndex)

It simply calls the function referenced in your post. I was just having
trouble with the index reference. Thanks again for takin the time to help a
novice.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top