Answer the question
In order to leave comments, you need to log in
How to simplify this c# code?
if (e.KeyCode == Keys.A)
{
textBox1.Text = e.KeyCode.ToString();
}
if (e.KeyCode == Keys.B)
{
textBox1.Text = e.KeyCode.ToString();
}
if (e.KeyCode == Keys.C)
{
textBox1.Text = e.KeyCode.ToString();
}
Answer the question
In order to leave comments, you need to log in
if(Keys.A <= e.KeyCode && e.KeyCode <= Keys.Z)
textBox1.Text = e.KeyCode.ToString();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question