Simple case statement looking for Enter key
-
I have the following case statement where I am looking for a enter key being pushed to be in the suffix. I need this to be a enter but I can not seem to figure out how to add the char(13) as I can not make it into a string and fit into the const setting. Can someone help me with this?
string keyAscii = e.KeyChar.ToString(); const string Prefix = "|~"; const string Sufix = ""; switch(keyAscii) { case Prefix: // Code break; case Sufix: //Code break; default: //Code break; }
-
I have the following case statement where I am looking for a enter key being pushed to be in the suffix. I need this to be a enter but I can not seem to figure out how to add the char(13) as I can not make it into a string and fit into the const setting. Can someone help me with this?
string keyAscii = e.KeyChar.ToString(); const string Prefix = "|~"; const string Sufix = ""; switch(keyAscii) { case Prefix: // Code break; case Sufix: //Code break; default: //Code break; }
Perhaps this will help: Keys Enumeration[^]
The need to optimize rises from a bad design. My articles[^]
-
I have the following case statement where I am looking for a enter key being pushed to be in the suffix. I need this to be a enter but I can not seem to figure out how to add the char(13) as I can not make it into a string and fit into the const setting. Can someone help me with this?
string keyAscii = e.KeyChar.ToString(); const string Prefix = "|~"; const string Sufix = ""; switch(keyAscii) { case Prefix: // Code break; case Sufix: //Code break; default: //Code break; }
Or
"\n"
?