I have two text boxes. one for login id and another is for password. and there is one button (submit). I need an event that takes the values of login id and password. I.e, without clicking the mouse I need to invoke this event(just by hitting 'enter' on keyboard). can anybody help me!
thanx in advance. srini.
Set the button to be the accept button on the form. You can do this by setting the forms "AcceptButton" property to be the button you want to trigger. This will make an enter key press trigger the button.
Simon P Stevens gave you the most adequate answer.
I would just add that you also have the possibility to set a form's CancelButton on which a click event would be triggered when you press the escape ESC key.
Quick summary
Enter --> AcceptButton
Esc --> CancelButton
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With