Hello Fabio,
You should attach to NComboBox.EditControl.KeyPress only when Editable property is true. The EditControl is actually a text box that represents the editable part of the combo box. When Editable is false EditControl will be null and you should be attached to NComboBox.KeyPress.
KeyPressEventArgs is the proper event argument for KeyPressEventHandler.
Basically you should do the following:
if
(nComboBox1.EditControl != null)
{
nComboBox1.EditControl.KeyPress += new KeyPressEventHandler(EditControl_KeyPress);
}
else
{
nComboBox1.KeyPress += new KeyPressEventHandler(nComboBox1_KeyPress);
}...
void nComboBox1_KeyPress(object sender, KeyPressEventArgs e)
{
DoSomething(sender, e);
}
void EditControl_KeyPress(object sender, KeyPressEventArgs e)
{
DoSomething(sender, e);
}
private void DoSomething(object sender, KeyPressEventArgs e)
{
//Do Something.
}
Best Regards,
Nevron Support Team