I am running on an issue using C# SendKeys.Send method. I am trying to replace keyboard keys with other keys, for example when I press "a" in keyboard I want that key to be "s" for example, when I am doing this in my code:
if ((Keys)keyCode== Keys.A)
{
SendKeys.Send("s");
}
Right now I get only "sa" character printed in my notepad, but instead of printing "sa" I need to get only "s" character in this case because when I press "a" on my keyboard, "a" must be replaced with "s".
I tried removing the last character by adding this line:
SendKeys.Send("{BS}");
But all I got is "s" character removed and "a" character was there.
How can I prevent this from happening?
I would reverse my calls:
SendKeys.Send("{BS}");
SendKeys.Send("S");
EDIT (After Question Updated):
If you're working with the string (for your special characters), can you not just capture the string generated by the key press ("a") and modify it by setting the string to the unicode value of the character you're attempting to represent? If the other solutions people have been mentioning aren't working, that's where I'd try next...