Handling KeyPress events in CF 2.0

Posted on 2009-04-20
Last Modified: 2013-12-17
Hi I have created a CF2.0 form with a picture box and running on a mobile device running WinCE 6.0 with USB keyboard connected.
I have to change the pictures in the "pictureBox" using keyboard keys. I have handled the "KeyPress" event for the form. But if I press any key on the keyboard, it is not generating any "event" in the form.

Any Ideas?
Thanks for your help.

this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.Form1_KeyPress);

//Event Handler

 private void Form1_KeyPress(object sender, KeyPressEventArgs e)




Open in new window

Question by:ukalyan
    LVL 85

    Accepted Solution

    Try setting the KeyPreview() Property of the Form to true:
    LVL 12

    Expert Comment

    by:Nirmalan Nagenthiran

    Featured Post

    Gigs: Get Your Project Delivered by an Expert

    Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

    Join & Write a Comment

    Suggested Solutions

    Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
    Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now