By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,467 Members | 1,594 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,467 IT Pros & Developers. It's quick & easy.

Capturing Keypress - No Keycode property available ??

P: n/a
Hi all

Hoping someone can help !!

I am trying to catch F2 - 6 key presses in a winforms application

Code as follows

private void frmMain_KeyPress(object sender,
System.Windows.Forms.KeyPressEventArgs e)
{
/*MessageBox.Show(e.KeyChar.ToString());*/

if(e.KeyCode == Keys.F2 )
MessageBox.Show("F2");
}

Now e is capturing the keypress fine (the messagebox works fine for
alpha\numeric) , however property wise for e i only have

KeyChar
Handled
and the usual tostring() etc

Thus can not test for keys.F2 as i have no e.Keycode ..(the
if(e>keyCode does not work )

Any ideas anyone ? Sure Im missing something simple but cant see it.

TIA Dave

Apr 3 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Appears I DO have the required properties on Keydown and Keyup events
which guess is good enough !!

Apr 3 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.