views:

1263

answers:

1

Hello,

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.

+4  A: 

For a list only combobox:

comboBox.DropDownStyle = ComboBoxStyle.DropDownList;

to get the text:

string text = comboBox.Text;
Mladen Mihajlovic