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
[email protected]
Printable View
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
[email protected]
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();
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:
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... =)Code:private void yourObject_KeyUp(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.F1)
{
// do stuff
}
}
Hope it helps!