VB.NET: how to prevent user input in a ComboBox
Seeing a user banging away at a control that overrides her decisions is a sad sight. Set the control's Enabled property to False. If you don't like that then change its Items property so only one item is selectable.
Use KeyPressEventArgs,
Private Sub ComboBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles ComboBox1.KeyPress
e.Handled = True
End Sub
Set the DropDownStyle
property of the combobox to DropDownList
. This will allow only items in the list to be selected and will not allow any free-form user input.