O
orekinbck
Hi There
In C# windows app, .NET 2003 I have a text box with the following event
handler:
private void textBox3_KeyDown(object sender,
System.Windows.Forms.KeyEventArgs e)
{
if (e.KeyCode == Keys.A)
e.Handled = true;
}
I would expect that the text box would not let me type a but it does
?!?!
However doing something very similar in a KeyPress event handler works
fine ?!?
private void textBox1_KeyPress(object sender,
System.Windows.Forms.KeyPressEventArgs e)
{
if (e.KeyChar == 'a')
e.Handled = true;
}
Why doesn't the code in the KeyDown event handler stop the user typing
in an a ?
TIA
Bill
In C# windows app, .NET 2003 I have a text box with the following event
handler:
private void textBox3_KeyDown(object sender,
System.Windows.Forms.KeyEventArgs e)
{
if (e.KeyCode == Keys.A)
e.Handled = true;
}
I would expect that the text box would not let me type a but it does
?!?!
However doing something very similar in a KeyPress event handler works
fine ?!?
private void textBox1_KeyPress(object sender,
System.Windows.Forms.KeyPressEventArgs e)
{
if (e.KeyChar == 'a')
e.Handled = true;
}
Why doesn't the code in the KeyDown event handler stop the user typing
in an a ?
TIA
Bill