JeremyG
JeremyG

Reputation: 71

Unable to send underscore with Sendkeys in C#?

I've been bored, so I tried to make a program that writes a Look of Disapproval smiley(the ಠ_ಠ face) when pressing ctrl+shift+L. Now everything works, except for the underscore that is in the smiley, which won't get written at all.

This was what I used first:

SendKeys.Send("ಠ_ಠ");

I've tried various things, like adding {} brackets around the underscore, and of course I googled this too.

Is there any way I can get the underscore to get sent?

Thanks in advance.

Upvotes: 7

Views: 1314

Answers (2)

foowtf
foowtf

Reputation: 399

If you don't use an english keyboard layout that has the underscore as key you can't just type the ASCII character but have to write it as a combination of modifier and character keys.

Upvotes: 0

MPelletier
MPelletier

Reputation: 16687

Mixing different encodings creates weird result. is Unicode, _ is ASCII. Different length characters confuse and iritate Visual Studio.

Try:

SendKeys.Send("\u0CA0_\u0CA0");

Or:

SendKeys.Send("\u0CA0\u005F\u0CA0");

Upvotes: 1

Related Questions