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

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

P: n/a
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)");
Nov 15 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Thu, 11 Sep 2003 12:25:24 +0530, "Gary" <ms****@microsoft.com>
wrote:
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...

--
NULL

Nov 15 '05 #2

P: n/a
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 -

"NULL" <Thomas-dot-Delrue-at-Tiscali-dot-Be> wrote in message
news:11********************************@4ax.com...
On Thu, 11 Sep 2003 12:25:24 +0530, "Gary" <ms****@microsoft.com>
wrote:
I am trying to use the "System.Windows.Forms.SendKeys" class for triggeringthe 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 theform gets loaded, when I press the "Ctrl+P" then the menu functionality isworking. 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...

--
NULL

Nov 15 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.