I'm creating a simple C# program that deals with pressing the DELETE key button in the keyboard. so what I created a key press event, but seems like the delete key doesn't work.. i tried it with other keys and it's working fine... why?? and is 46 the keycode for delete?

handle it with keydown event :

private void TextBox1_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
{
	if (e.KeyCode == Keys.Delete)
	{
		MessageBox.Show("you pressed delete key");
	}
}
commented: Good +1
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.