Thursday, 25 March 2010

Disable typing in a combobox

Just a quickie: I wanted to be able to prevent a user from typing in a Windows Forms ComboBox and struggled to find the answer. Anyway, to stop someone from typing in your combobox, just go to the Properties window, in design mode, and under DropDownStyle, choose the DropDownList. Alternatively, in code, type:
cmbTotalRows.DropDownStyle = ComboBoxStyle.DropDownList;
That's it!

Thanks for your time.

No comments:

Post a Comment