Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: form keypress event does not work when a control has focus

37 views
Skip to first unread message

Alex Yakhnin

unread,
Oct 7, 2005, 6:37:19 AM10/7/05
to
You should set the Form's PreviewKeys to true.

--
Alex Yakhnin, .NET CF MVP
www.intelliprog.com
www.opennetcf.org

"Tobin" <To...@discussions.microsoft.com> wrote in message
news:2527E207-D69E-4499...@microsoft.com...
> I'm trying to develop a mobile app in VS.NET 2003 in visual basic deployed
> to
> a windows CE 2.0 device. The form keypress/keyup events work great until
> I
> set focus to a listview, listbox, textbox, etc... then they stop firing.
>
> Any suggestions to capture key events when a control has focus would be
> greatly appreciated.


Tobin

unread,
Oct 8, 2005, 2:25:39 PM10/8/05
to
The KeyPreview property is not available to me when I bring up the form
properties. This is a mobile app and seems to be severly limited compared to
normal vb.net development in the GUI area.

The keypress/keyup/keydown events work UNTIL any control gets focus and then
not even that control's keypress events work.

Any other suggestions?

Thank you,

Tobin

<ctacke/>

unread,
Oct 8, 2005, 8:26:45 PM10/8/05
to
Use an IMessageFilter implementation. That catches everything.

-Chris


"Tobin" <To...@discussions.microsoft.com> wrote in message

news:93214E95-5FF7-4296...@microsoft.com...

Daniel Moth

unread,
Oct 9, 2005, 2:31:25 PM10/9/05
to
You do realise CE 2.0 is not supported, right?

If you meant a PPC or a WinCE v4.1 and greater device, then Alex's reply for
CF v2.0 or Chris's for CF v1.0...

Cheers
Daniel
--
http://www.danielmoth.com/Blog/

Tobin

unread,
Oct 10, 2005, 8:02:04 AM10/10/05
to
It is WinCE 4.1 or higher.... I will research Alex's reply. Thanks for the
advice.

Tobin

<ctacke/>

unread,
Oct 10, 2005, 9:30:29 AM10/10/05
to
CF 2.0 is not supported on CE 4.1. You'll have to look at the
IMessageFilter.

-Chris

"Tobin" <To...@discussions.microsoft.com> wrote in message

news:B6A27098-1A54-47A4...@microsoft.com...

Sergey Bogdanov

unread,
Oct 10, 2005, 9:33:41 AM10/10/05
to
The example how to use IMessageFilter for KeyDown trapping you may find
here:
http://www.sergeybogdanov.com/Samples/TextBoxKeyDownFilter.zip


--
Sergey Bogdanov [.NET CF MVP, MCSD]
http://www.sergeybogdanov.com

Tobin

unread,
Oct 11, 2005, 10:15:05 PM10/11/05
to
I think the IMessageFilter is the way I want to go.... but I haven't been
able to assemble a working version in VB.NET (thanks for the C# sample
though).

Searching through MSDN on IMessageFilter, they do not give a complete sample
for VB... tough to find one on the net as well.

Is it possible to implement the IMessageFilter interface in VB.NET?

Tobin

Sergey Bogdanov

unread,
Oct 12, 2005, 4:21:58 AM10/12/05
to
The IMessageFilter interface is a part of Smart Device Framework which
available here:
http://www.opennetcf.org/sdf/

Tobin

unread,
Oct 12, 2005, 8:39:04 PM10/12/05
to
Thanks so much, that's the final piece that made this whole thing make sense.
Mystery solved.
0 new messages