How to show text in combobox when no item selected?

前端 未结 16 1268
太阳男子
太阳男子 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:09

    Make the Dropdownstyle property of combo box to Dropdown and set the combo box text to "Select" as below

                combobox.DataSource = dsIn.Tables[0];
                combobox.DisplayMember = "Name";
                combobox.ValueMember = "Value";
                combobox.Text = "--Select--";
    

提交回复
热议问题