You’re trying to implement the class SendKeys
? Don’t do this!
SendKeys
is a class that provides methods to send a keystroke to the application.
When you need to use the functionality of this class in your code just do:
SendKeys.Send(/*Aqui vai a tecla que deseja enviar*/);
Each key is represented by one or more characters. To specify a unique keyboard character, use the character itself. For example, to represent the letter A, pass the string "A" to the method. To represent more than one character, add each additional character to the one above. To represent the letters A, B and C, specify the parameter as "ABC".
The addition sign (+), circumflex ( ), percentage sign (%), tilde (~) and parentheses () have special meanings for Sendkeys. To specify one of these characters, put it between keys ({}). For example, to specify the plus sign, use "{+}". To specify key characters, use "{{}" and"{}}". Brackets ([]) have no special meaning for Sendkeys, but you should include them between keys. In other applications, brackets have a special meaning that can be significant when dynamic data exchange occurs (DDE).
I tried to do so earlier but was not giving "Sendkeys does not exist in the current context". Follows error screenshot: https://imgur.com/a/2f0My0H
– Arthur Luiz
It has this clause
using System.Windows.Forms;
in your program?– Augusto Vasques
That’s right, I didn’t even notice. Thank you very much. :)
– Arthur Luiz