PC Review


Reply
Thread Tools Rate Thread

how to capture KeyDown event in a ComboBox?

 
 
jerry way
Guest
Posts: n/a
 
      21st Sep 2003
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?
 
Reply With Quote
 
 
 
 
Maarten Struys
Guest
Posts: n/a
 
      21st Sep 2003
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/d...displaylang=en.


--
Regards,

Maarten Struys
PTS Software bv

"jerry way" <(E-Mail Removed)> wrote in message
news:988c01c37ff6$93382b00$(E-Mail Removed)...
> 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?



 
Reply With Quote
 
Chris Craft
Guest
Posts: n/a
 
      21st Sep 2003
You can download the Compact Framework service pack 2 from
http://www.microsoft.com/downloads/d...displaylang=en

It adds KeyDown, KeyUp, and KeyPress events to all controls.

Thanks,
Chris Craft
http://www.cjcraft.com/

"jerry way" <(E-Mail Removed)> wrote in message news:<988c01c37ff6$93382b00$(E-Mail Removed)>...
> 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?

 
Reply With Quote
 
Jerry Way
Guest
Posts: n/a
 
      22nd Sep 2003
Thanks for your reply, however after installing SP2,
KeyDown/KeyUp events still don't fire with ComboBox :-(

>-----Original Message-----
>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/details.aspx

familyid=10600643-09b3-46d8-ba28-
bc494bc20d26&displaylang=en.
>
>
>--
>Regards,
>
>Maarten Struys
>PTS Software bv
>
>"jerry way" <(E-Mail Removed)> wrote in message
>news:988c01c37ff6$93382b00$(E-Mail Removed)...
>> 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?

>
>
>.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
call a combobox KeyDown event from another procedure Aleksander Śliwiński Microsoft Excel Programming 2 26th Aug 2009 08:14 PM
how do I capture the control enter sequence in keydown or keypressed event? GS Microsoft VB .NET 2 25th Feb 2008 03:51 PM
cant capture KeyDown Keys.Down event on usercontrol Brian Henry Microsoft VB .NET 1 21st Jul 2005 11:26 PM
Redirect or capture keydown event from a child form Frank T. Clark Microsoft C# .NET 3 3rd Oct 2003 06:21 PM
KeyDown in combobox not fired PeterB Microsoft Dot NET Compact Framework 3 1st Sep 2003 08:07 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:58 PM.