Reputation: 33
I'm attempting to send the { key using SendKeys.SendWait(y)
. I'm passing a variable, y in this case, that has been set with a string containing {.
string y = "u8HXV/gIE_{";
SendKeys.SendWait(y);
SendKeys.SendWait("{TAB}");
SendKeys.SendWait("{ENTER}");
I'm getting the following error:
An exception of type 'System.ArgumentException' occurred in System.Windows.Forms.dll
but was not handled in user code
Additional information: Keyword delimiter is missing.
Is there a way of escaping this keyword { within SendKeys?
Upvotes: 3
Views: 3708
Reputation: 7830
The curly brace is a special symbol for the SendKeys method, so you need to escape it (treat it like special symbol) like this:
SendKeys.SendWait("{{}");
The output is: {
Upvotes: 2