how to capture KeyDown event in a ComboBox?

  • Thread starter Thread starter jerry way
  • Start date Start date
J

jerry way

Does anyone know how to capture the KeyDown event in a
ComboBox? Since this event is not supported in compact
framework, I created a customized ComboBoxEx control,
which is derived from ComboBox and overrides its OnKeyDown
method - this is the recommended way in MSDN but however
it doesn't work.

Anyone has thoughts on this?
 
Too bad you put in some work already, because with the release of the .NET
CF SP2 earlier this week the KeyUp, KeyDown events are available in the
ComboBox and in all other controls as well.

Snippet of the improvements:
.NET Compact Framework 1.0 Service Pack 2 details:

Performance & Other Improvements List:
- Extend keyboard events to be enabled on all controls (Control.KeyUp,
KeyDown, KeyPress)


So what you can do now when having a regular ComboBox is the following:

//
// comboBox1
//
this.comboBox1.KeyDown += new
System.Windows.Forms.KeyEventHandler(this.comboBox1_KeyDown);
and simply write a KeyDown handler for it:

private void comboBox1_KeyDown(object sender,
System.Windows.Forms.KeyEventArgs e)

{

MessageBox.Show("KeyDown event received");


}


SP2 is available for download at the following URL:
http://www.microsoft.com/downloads/...43-09b3-46d8-ba28-bc494bc20d26&displaylang=en.
 
Thanks for your reply, however after installing SP2,
KeyDown/KeyUp events still don't fire with ComboBox :-(
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top