Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to clear combo box contents in vb.net

Tags:

vb.net

If for textbox it is textbox1.clear, etc. What is the equivalent for combobox to clear the value.

like image 647
user225269 Avatar asked Mar 16 '10 23:03

user225269


People also ask

How do you clear a combo?

The easiest way to clear the second combobox is to just use Reset(). That will clear all the current selections and reset the combobox to its default selection.

How do I clear my DataSource ComboBox?

When you data bind a control, it will synchronize with that collection. In order to clear the items in your ComboBox set it's DataSource to null. Save this answer.

How do you delete a ComboBox selection in VB net?

Clear() it clears all the items in the combobox and when i use ComboBox1. SelectedIndex = -1 it doesn't show any text and when i choose any of the entry, it doesn't show, it's blank. Well unless you've wiped all that from the db, you should unbind the combo from the data.


2 Answers

Try using combobox.Items.Clear()

like image 75
Dean Harding Avatar answered Sep 18 '22 11:09

Dean Harding


If your combobox is set with the DropDownList, then use Combobox1.SelectedIndex = -1

like image 33
user3455626 Avatar answered Sep 20 '22 11:09

user3455626