For a
KeyDown
event, you've a
KeyEventArgs
as a parameter, not a
KeyPressEventArgs
.
You should use a
KeyPressEventArgs
as a parameter for the
KeyPress
method.
Set the parameter to a
KeyEventArgs
(or use a
KeyDown
event instead of a
KeyPress
event) and try this:
private void textBox1_Keydown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Up)
{
}
}
Hope this helps.