Answers for "form1_keydown enter not working"

C#
0

form1_keydown enter not working

//Instead of using the "form1_keydown" event, use "form1_keyup" event.

//Example:

private void Form1_KeyUp(object sender, KeyEventArgs e)
{
	if(e.KeyCode == Keys.Enter)
	{
      // Stuff...
	}
}

// This won't detect the Enter key being pressed,
// but it will work for other keys such as numbers..
private void Form1_KeyDown(object sender, KeyEventArgs e)
{
	if(e.KeyCode == Keys.Enter)
	{
      //Stuff...
	}
}


// Not sure why it is like that, but that's the solution!
Posted by: Guest on September-15-2021

C# Answers by Framework

Browse Popular Code Answers by Language