How do I capture the enter key in a windows forms combo box when the combobox is active?
I\'ve tried to listen to KeyDown and KeyPress and I\'ve created a subclass a
protected void Form_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == 13) // or Key.Enter or Key.Return { MessageBox.Show("Enter pressed", "KeyPress Event"); } }
Don't forget to set KeyPreview to true on the form.