My event handler looks like this:
private void List_KeyPress(object sender, KeyPressEventArgs e)
I saw on a msdn thread, the following solution:
if(e.KeyCode == Keys.Delete)
But, in this version of .net, the KeyPressEventArgs doesn’t have a KeyCode property. How should I handle the delete in my case?
You want the KeyDown event instead:
This isn’t limited to just .NET 2.0, in all .NET versions
KeyPressEventArgsdoes not have a.KeyCodesee: MSDN, so you have to use KeyDown instead.