T
Tony Johansson
Hello!
I have dragged a textbox from the toolbox into the form and then used the
designer to create an event handler
named textBox1_KeyUp and a textBox1_KeyDown eventhandler
The eventhandler textBox1_KeyDown works correct. If I hold down for example
control in the textbox field the text KeyDown CTRL is written in the console
window.
Now to my question eventhandler textBox1_KeyUp doesn't work.If I hold down
control in the textbox field this statement e.Control == true is still false
why ?
private void textBox1_KeyUp(object sender, KeyEventArgs e)
{
if (e.Control == true)
Console.WriteLine("keyUp CTRL");
if (e.Alt == true)
Console.WriteLine("KeyUp ALT");
if (e.Shift == true)
Console.WriteLine("KeyUp SHIFT");
}
private void textBox1_KeyDown(object sender, KeyEventArgs e)
{
if (e.Control == true)
Console.WriteLine("KeyDown CTRL");
if (e.Alt == true)
Console.WriteLine("KeyDown ALT");
if (e.Shift == true)
Console.WriteLine("KeyDown SHIFT");
}
//Tony
I have dragged a textbox from the toolbox into the form and then used the
designer to create an event handler
named textBox1_KeyUp and a textBox1_KeyDown eventhandler
The eventhandler textBox1_KeyDown works correct. If I hold down for example
control in the textbox field the text KeyDown CTRL is written in the console
window.
Now to my question eventhandler textBox1_KeyUp doesn't work.If I hold down
control in the textbox field this statement e.Control == true is still false
why ?
private void textBox1_KeyUp(object sender, KeyEventArgs e)
{
if (e.Control == true)
Console.WriteLine("keyUp CTRL");
if (e.Alt == true)
Console.WriteLine("KeyUp ALT");
if (e.Shift == true)
Console.WriteLine("KeyUp SHIFT");
}
private void textBox1_KeyDown(object sender, KeyEventArgs e)
{
if (e.Control == true)
Console.WriteLine("KeyDown CTRL");
if (e.Alt == true)
Console.WriteLine("KeyDown ALT");
if (e.Shift == true)
Console.WriteLine("KeyDown SHIFT");
}
//Tony