I currently have this code:
if (e.KeyChar == (char)8)
{
}
What I would like is the C# equivalent of the vbBackspace constant. Is there such a thing in C#?
Example:
if (e.KeyChar == SomeNameSpace.Something.Backspace)
{
}
Variables can be declared as constants by using the “const” keyword before the datatype of the variable. The constant variables can be initialized once only. The default value of constant variables are zero.
String Literals. A String Literal, also known as a string constant or constant string, is a string of characters enclosed in double quotes, such as "To err is human - To really foul things up requires a computer." String literals are stored in C as an array of chars, terminted by a null byte.
Answer: 6 isn't a constant character. As long as the character is enclosed in quotation marks (“), it is considered to be an enclosing character constant. During the execution of a programme, characters in the character set are represented by character constants.
if (e.KeyChar == Keys.Back)
{
}
Look here for more info
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With