Reputation: 611
I have a windows form that contains comboboxes. I want to set KeyPressEventArgs.Handled
properties as "true
" to block data input via keyboard for each combobox. Because comboboxes have its items defined and I want no input data from user. Is there a way to do this via using foreach spinnet or like that?
Upvotes: 0
Views: 112
Reputation: 1064
You can set ComboBox's Style property to DropDownList which prevents entering any character into comboBox and allows just selecting from internal items.
comboBox.Style = ComboBoxStyle.DropDownList;
you can do this from designer or you can iterate on comboBoxes and set Style property programmatically.
Upvotes: 2