How to show text in combobox when no item selected?

前端 未结 16 1368
太阳男子
太阳男子 2020-11-30 06:39

C# & .Net 2.0 question (WinForms)

I have set of items in ComboBox and non of them selected. I would like to show a string on combo \"Pl

16条回答
  •  不知归路
    2020-11-30 07:02

        private void comboBox1_TextChanged(object sender, EventArgs e)
        {
            if (comboBox1.Text == "")
                comboBox1.Text = "Select one of the answers"; 
        }
    

    should do the trick at startup this line is present, when selected an item on combobox, this items text will appear. when deleling the text this text will appear again

提交回复
热议问题