I have some combo-boxes that are set up as drop down lists, and the user can pick a number in them. I also have a Clear button that should clear the text from the combo boxes but I can't seem to get it. I've tried:
//doesn't work cboxHour.Text = "";
and
//doesn't work cboxHour.ResetText();
This seems like it should be so straight forward but I'm just not getting it.
Use: ComboBox1. Value = Null to clear the value as mentioned above.
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.
In order to clear the items in your ComboBox set it's DataSource to null.
Did you try cboxHour.Items.Clear()
?
If you just want to clear the current selection, but leave all of the items in the list, you can use:
cboxHour.SelectedIndex = -1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With