A
Andrus
C# .NET 2 WinForms.
I need to open ComboBox dropdown list if user presses F12
I tried the code below (F4 opens dropdown list by default) but got compile
error
Property or indexer 'System.Windows.Forms.KeyEventArgs.KeyCode' cannot be
assigned to -- it is read only
How to fix ?
Andrus.
class MyComboBox : ComboBox {
protected override void OnKeyDown(KeyEventArgs e) {
if (e.KeyCode == Keys.F12)
e.KeyCode = Keys.F4;
base.OnKeyDown(e);
}
I need to open ComboBox dropdown list if user presses F12
I tried the code below (F4 opens dropdown list by default) but got compile
error
Property or indexer 'System.Windows.Forms.KeyEventArgs.KeyCode' cannot be
assigned to -- it is read only
How to fix ?
Andrus.
class MyComboBox : ComboBox {
protected override void OnKeyDown(KeyEventArgs e) {
if (e.KeyCode == Keys.F12)
e.KeyCode = Keys.F4;
base.OnKeyDown(e);
}