简体   繁体   中英

Setting blank text in c# combo box

So I am using a combo box that the user is only allowed to choose a few options. I am working on user validation right now. When you start the program the there is no text in the combo box. I want to be able to reset the combo box back to that default and make it blank when ever I need to. I have been trying things such as comboBox1.Text = ""; and that was a no go. I even tried doing comboBox1.Items.Clear(); Then re adding all the items back in again. Re adding the items wouldn't be an issue except one of the combo boxes is very lengthy.

Is there a way to make a combo box returns to its default of being blank?

用 :

ComboBox1.SelectedIndex = -1

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM