P
Publicjoe
OK Folks, I am one confused puppy. Can someone please explain what the
difference is and when to use each.
I have a form with a button dropped onto it. Without actually doing anything
to the button, I next add the following code:
protected override void OnKeyDown(KeyEventArgs e)
{
System.Diagnostics.Debug.WriteLine(e.KeyCode.ToString());
base.OnKeyDown(e);
}
When you press a key, it is not handled. If you change the tabstop property
of the form to false, the it is now handled. Why?
However, if I put the tabstop back to true and I add an keydown event
instead:
private void button1_KeyDown(object sender, KeyEventArgs e)
{
System.Diagnostics.Debug.WriteLine(e.KeyCode.ToString());
}
When you press a key it is handled. What is happening that is different?
My understanding of what happens when you override a form method seems to be
shot to pieces.
So when should you override form methods and when should you use events?
Any clarification on this subject area would be most appreciated.
Thanks
Mike
difference is and when to use each.
I have a form with a button dropped onto it. Without actually doing anything
to the button, I next add the following code:
protected override void OnKeyDown(KeyEventArgs e)
{
System.Diagnostics.Debug.WriteLine(e.KeyCode.ToString());
base.OnKeyDown(e);
}
When you press a key, it is not handled. If you change the tabstop property
of the form to false, the it is now handled. Why?
However, if I put the tabstop back to true and I add an keydown event
instead:
private void button1_KeyDown(object sender, KeyEventArgs e)
{
System.Diagnostics.Debug.WriteLine(e.KeyCode.ToString());
}
When you press a key it is handled. What is happening that is different?
My understanding of what happens when you override a form method seems to be
shot to pieces.
So when should you override form methods and when should you use events?
Any clarification on this subject area would be most appreciated.
Thanks
Mike