How to make Combobox in winforms readonly

后端 未结 18 2105
攒了一身酷
攒了一身酷 2020-12-08 09:40

I do not want the user to be able to change the value displayed in the combobox. I have been using Enabled = false but it grays out the text, so it is not very

18条回答
  •  旧时难觅i
    2020-12-08 10:13

    Why don't you just use a text box? Text box has a "Read only" property, and since you want your combo box only to display data, I don't see why you would need a combo box.

    An alternative is that you just cancel out the input for the "on value changed" event. That way you will be displaying your information no mater what user does ...

提交回复
热议问题