Remove Item from an owner drawn listbox

chidambaram

Well-known member
Joined
Dec 27, 2007
Messages
62
Location
Chennai,India
Programming Experience
Beginner
Hi,

I tried to add icons to the items in the listbox(owner drawn listbox- variable). I m able to do it. But after adding the items, according to my requirement i need to remove few items now and then.

I used:
Listbox1.Items.Remove("Aqua")

This removes the last item from the listbox instead of the mentioned one. the same is done even if i try to remove the selected index item...

Can someone pls help me with the code to do this...
Thank you.
 
Have you tried:
VB.NET:
Listbox1.Items.Remove(Listbox1.SelectedItem) 'or
Listbox1.Items.RemoveAt(Listbox1.SelectedIndex)
 
Yes, I tried by giving selectedIndex, by mentioning the index explicitly and in Remove() method i tried by giving the name of the listbox item...

All these work for a normal listbox, but in an owner drawn listbox, i m not able to do...

If i get the selectedIndex value in msgbox i m gettin the exact value but the removal alone is not done.

Someone pls help...
 
Back
Top