I am doing this registration form in C #, and I wanted to βsendβ all the data as soon as the user either clicks the βSendβ button or presses the enter / return key.
I tested KeyEvents a bit, but nothing worked.
void tbPassword_KeyPress(object sender, KeyPressEventArgs e) { MessageBox.Show(e.KeyChar.ToString()); }
The code above was supposed to check if the event really worked in the first place. It works great when I press "d", it shows me "d", when I press "8", it shows me "8", but pressing the enter key does nothing.
So, although it was because the attachment was not tied to a character, but it displayed backspace, it worked fine, so I was confused why it did not register my input key.
So the question is: How do I enter the input / return key? and why is it not registering a keystroke right now, as it should?
Note: I put this event in a text box
tbPassword.KeyPress += new KeyPressEventHandler(tbPassword_KeyPress);
Thus, it works when you press the WHILE enter button, when the text field is selected (this has been the whole time, of course), maybe something has to do with the code execution.
source share