Reputation: 35522
I'd like to know how to set a combobox to be read only,meaning the user cannot write text into it,but just select?
Another question,how to determinate the text of the selected choice.For example it has index of 4 values(10,20,30 and 40).If the user chooce 20,how can I get the Text of the choice he selected(Not the index number,but text)?
Thanks.
Upvotes: 1
Views: 2451
Reputation: 6435
For a list only combobox:
comboBox.DropDownStyle = ComboBoxStyle.DropDownList;
to get the text:
string text = comboBox.Text;
Upvotes: 4