amr
amr

Reputation: 3

vb.net SendKeys.Send does not send () symbol from textbox.text

i try to send symbol Through text box when i send (10%)+(20%) to notepad the result 10+20 !not (10%)+(20%) this is the code i use

SendKeys.SendWait("TextBox1.Text")

Upvotes: 0

Views: 717

Answers (2)

Deja Vu
Deja Vu

Reputation: 413

If you read this link you find:

The plus sign (+), caret (^), percent sign (%), tilde (~), and parentheses () have special meanings to SendKeys. To specify one of these characters, enclose it within braces ({}).

So you have to change your text to be:

SendKeys.SendWait({(}10{%}{)}{+}{(}20{%}{)})

Upvotes: 0

Phillip Trelford
Phillip Trelford

Reputation: 6543

According to the documentation the plus sign, percentage symbol and parentheses have a special meaning in the context of SendKeys. You need to enclose those symbols in curly braces.

SendKeys.SendWait("{(}10{%}{)}{+}{(}20{+}{)}")

You could use the String.Replace method to do the mapping for you, e.g. text.Replace("+", "{+}") etc.

Upvotes: 1

Related Questions