Solved

Trap function keys Winforms.

Posted on 2006-11-06
2
696 Views
Last Modified: 2008-02-01
I have a windows form application with a few user specified options.  I could use radio buttons, but I would like to use function key to toggle options off and on.  For example F5 toggles between "SUMMARY DATA" and "DETAIL DATA", F6 toggles between "HOME" and "AWAY", etc.  I can't find any documentation on trapping when a function key is pressed.  This needs to work wherever control is on the form.
0
Comment
Question by:MGothelf
2 Comments
 
LVL 48

Accepted Solution

by:
AlexFM earned 125 total points
ID: 17883256
Set Form KeyPreview property to true. Add KeyDown event handler:

void Form1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
    if ( e.KeyCode == Keys.F5 )
    {
         ...
    }
    else if ( e.KeyCode == Keys.F6 )
    {
        ...
    }
    ...
}
0
 

Author Comment

by:MGothelf
ID: 17883444
THANK YOU!!!!!
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
network + 7 73
Chat Room 1 30
Hide Tab Page 3 20
Why its difficult to  Insert the Bit and date time value in sql Database 7 32
Introduction                                                 Was the var keyword really only brought out to shorten your syntax? Or have the VB language guys got their way in C#? What type of variable is it? All will be revealed.   Also called…
Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

746 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

12 Experts available now in Live!

Get 1:1 Help Now