SendKeys.Send("^(P)"); not working

  • Thread starter Thread starter Gary
  • Start date Start date
G

Gary

I am trying to use the "System.Windows.Forms.SendKeys" class for triggering
the Ctrl+P key.

Syntax:
System.Windows.Forms.SendKeys.Send("^(P)");

This is not working ..what could be the reason..?

Situation:
I have a menu in my form, which is given a short key "Ctrl+P", now when the
form gets loaded, when I press the "Ctrl+P" then the menu functionality is
working. But the same thing I wanted to trigger on a button on click with
the following code..

System.Windows.Forms.SendKeys.Send("^(P)");

this is not working..

Note: Infact any of the "Ctr+AnyAlphabet", ie, Ctrl+A or..Ctrl+B..or
...C..like that is not working when using
System.Windows.Forms.SendKeys.Send("^(P)");
But the same thing is working fine, when I have as "Ctrl+AnyNumber", ie,
Ctrl+1 or Ctrl+2 with
System.Windows.Forms.SendKeys.Send("^(1)");
 
I am trying to use the "System.Windows.Forms.SendKeys" class for triggering
the Ctrl+P key.

Syntax:
System.Windows.Forms.SendKeys.Send("^(P)");

This is not working ..what could be the reason..?

Situation:
I have a menu in my form, which is given a short key "Ctrl+P", now when the
form gets loaded, when I press the "Ctrl+P" then the menu functionality is
working. But the same thing I wanted to trigger on a button on click with
the following code..

System.Windows.Forms.SendKeys.Send("^(P)");

this is not working..

Note: Infact any of the "Ctr+AnyAlphabet", ie, Ctrl+A or..Ctrl+B..or
..C..like that is not working when using
System.Windows.Forms.SendKeys.Send("^(P)");
But the same thing is working fine, when I have as "Ctrl+AnyNumber", ie,
Ctrl+1 or Ctrl+2 with
System.Windows.Forms.SendKeys.Send("^(1)");

You must send this command to the correct form...
 
Thanks for the reply.
I got the solution.... the call is case-sensetive and hence the following
would work:

System.Windows.Forms.SendKeys.Send("^(p)");

- Gary -
 
Back
Top