-
January 20th, 2012, 03:04 AM
#1
C# Sendkeys Keydown HELP PLEASE!
i am sorta new to C# programming and i was wondering how to make it so when i press F1 it will use sendkeys/or type something in less than a second! (instant!)
thanks,
--
mfish56
aaptprovider@gmail.com
-
January 24th, 2012, 08:21 PM
#2
Re: C# Sendkeys Keydown HELP PLEASE!
here is the solution create button on form (add the send keys function in it) and invoke that button through coding when needed
button1.PerformClick();
-
January 25th, 2012, 08:33 AM
#3
Re: C# Sendkeys Keydown HELP PLEASE!
Or you could add a KeyPressed/Down/Up event to the object that should capture the F1, and use the event arguments to check what was pressed.
For example:
Code:
private void yourObject_KeyUp(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.F1)
{
// do stuff
}
}
The more appropriated event would be KeyPressed I guess, but the eventArgs don't have a KeyCode, only KeyChar, and you can't use Keys.F1 to compare. Perhaps a simple cast would do the trick, haven't tested. Anyway, you get the general idea... =)
Hope it helps!
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|