C# Sendkeys Keydown HELP PLEASE!
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: C# Sendkeys Keydown HELP PLEASE!

  1. #1
    Join Date
    Nov 2011
    Posts
    2

    Arrow 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

  2. #2
    Join Date
    Jan 2012
    Posts
    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();

  3. #3
    Join Date
    Jun 2011
    Location
    Buenos Aires, Argentina
    Posts
    109

    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
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center