Alright, I have been struggling with this for a while. I just sort of want to grasp and test out everything I have learned, but that's hard to do when they don't seem to work.
Basically all I want to do is cause an event [MessageBox] when I hit a key. In this case, Enter. I think the event will be very helpful with a lot of the apps I plan on making. I have searched all over and on here and used all the examples, but nothing works.
Here is what I got:
(Tester is the TEXTBOX)
private void TESTER_KeyDown(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == 13)
{
MessageBox.Show("Test Complete");
}
}
I can build and run fine, but that instance never takes. I put the code in both Form.cs and Designer.cs. Nothing. I am not sure what I am doing wrong. Everytime I read on a forum when they attempt this code and ask for help, they get the above as a solution and it works for them.
Notes:
-I have KeyPreview set to True.
-I have tried KeyDown.
-I have tried (char)Keys.Enter.
-I have tried other ASCII keys.