Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I delete Items from a ComboBox

Status
Not open for further replies.

RotorTorque

Programmer
Apr 29, 2007
100
US
Hi all,
I use a ComboBox in my VB.Net 2005 application. I allow the users to add items to this ComboBox by entering an items name in a TextBox they then press a button and the item is added to the ComboBox.
Now they want to be able to remove an item from the ComboBox if they mistakenly add something. How can this be done?

Thank you in Advance,
RotorTorque :)
 
I believe it is something like

Code:
MyComboBox.Items.Remove(MyComboBox.SelectedIndex)

Hope it helps,

Alex

[small]----signature below----[/small]
Numbers is hardly real and they never have feelings but you push too hard, even numbers got limits
Why did one straw break the camel's back? Here's the secret: the million other straws underneath it

My Crummy Web Page
 
AlexCuse,
In my ComboBox, if I right-click a dropdown menu appears. One of the options in the menu is Delete. Is there a way to capture the event when a user clicks on Delete?


Thanks you
RotorTorque :)
 
I'm not sure about this. I think you'd need to create your own context menu and assign that to the ComboBox. Then, have the code to delete a given item in the delete option of this menu.

[small]----signature below----[/small]
Numbers is hardly real and they never have feelings but you push too hard, even numbers got limits
Why did one straw break the camel's back? Here's the secret: the million other straws underneath it

My Crummy Web Page
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top