How to do this? I read that it is done in event.
Do you want it so that if you press enter in your textbox it will click a button for you?
If so you can use the following:
private void txtBox_keyDown(object sender, KeyEventArgs e)
if (e.KeyValue == 13) //13 = enter
If this is not what you want you should clarify your question.
Alternativley, set the forms AcceptButton property to the button you want to execute on Enter.
Setting the forms CancelButton property will do the same thing for Escape.
And setting the forms HelpButton captures the F1 key.
Your can use this code:
private void TextBox1_KeyPress(object sender, KeyPressEventArgs e)
String key = Convert.ToString(e.KeyChar);
if (key == "r")// r notifies return key
Edited 5 Years Ago
by Nick Evan: Fixed formatting
I used the acceptbutton property. Thanks
I have the following problem.
when i pres buttun printpreview (button 5) the the print preview fires up.
and when i close the print preview without printing and minimize the ...
Hi all! I need help understanding what my teacher expects from this project.
Here is the link to the instructions for the project: http://cs.ecu.edu/~karl/2530/spr18/Assn/Assn5/assn5.html
I wrote a little bit of ...
Anyone have a shell script to remove controlM character from all the files in a directory