• Advertisement
Sign in to follow this  

? represent 'backspace' in c# string

This topic is 3029 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello Im making a program that will auto fill forms. I am using the SendKeys.Send(string) function to send the text to the active application. However, my problem is that some forms have default data that I need to delete before I fill in the correct data. How can I send a series or even 1 'delete' key or 'backspace' key command to the active application? Is there a way to represent it in the string? I know carriage return is \r and new line is \n when i would program in C++, but i dont know what is the code for backspace or delete, and i dont even know if it works the same way in C# strings. Any help is appreciated, thanks

Share this post


Link to post
Share on other sites
Advertisement
[google]

if you google "SendKeys.Send" the very first link is the msdn documentation, which will tell you that backspace is {BACKSPACE}, {BS}, or {BKSP} and delete is {DELETE} or {DEL}

Share this post


Link to post
Share on other sites
In C/C++, you can use the '\b' escape character to represent a backspace, but it increases the string by one more character, so both the backspace representation and the character being "backspaced" are still in the string contributing to its length.

However, C# doesn't support this. I even tested it really quickly, and it shows a black bar with a white dot, kinda like half a domino.

But, you're in luck. (And you need to check MSDN out for these things more often.) Clickified link to MSDN's page for SendKeys.Send Method. Scrolling down a bit, it says that to use keys that are more actions than characters, you can enclose them. So "{BACKSPACE}" would create a backspace. This seems limited to the SendKeys.Sent, though.

Best o' luck.

[EDIT]
CURSE MY LONG WINDEDNESS, ALLOWING SEVERAL NINJAS IN HERE! D:
That and I was on #gamedev when Washu killed it today. >_>

Share this post


Link to post
Share on other sites
Thanks for all the replies. As for the google it suggestions, I always google first before asking in the forums, its just I really really suck at finding info, google or otherwise.

Thanks again.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement