Question

Hello
I want to send CTR + A to other application for select all text in text box but I don't know how can i send 2 keys simultaneously
I split all keys and send all one by one
for send key i use from this code :

System.Windows.Forms.SendKeys.Send(keys);

now how can i send 2 keys simultaneously
or how can i send ctr + A to other app for select all , can i use from SendKeys or have any other option for send ctr + A simultaneously or any other option for select all text from another application ?


thanks.
kind regards,
sam

Was it helpful?

Solution

Thanks Hans Passant

Answer : That's already support by SendKeys, be sure to read the MSDN article. Sending Ctrl+A just takes sending "^A". The ^ means Ctrl.

OTHER TIPS

been through this.

The only working solution:

Find your element where you want to enter text

 element.SetFocus();

 Thread.Sleep(2000);

 SendKeys.SendWait("^{HOME}");  // Move to start of control

 SendKeys.SendWait("^+{END}"); // Select everything

 SendKeys.SendWait("{DEL}"); 

 SendKeys.SendWait("Value");

On the Enter event for the NumericUpDown control:

private void highlightNud_Event(object sender, EventArgs e)
{
    SendKeys.Send("^A");
}

This is worked for me for many, many years (flawlessley).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top