Handle a procedure with a keystroke?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Can I set a procedure to be run from a keystroke in a VB.NET web application
For instance, I would like the submit button of a form to be clicked when the user hits the enter key. I have other user controls on the form with buttons inside of them, and the first button in the user control always gets clicked. I remember coming across this before, but do not remember if it was for web application use
 
On the form there are two properties which deal with what you are asking.

AcceptButton should be set to the "submit" button and will accept the Enter
key as its firing mechanism. There is also the CancelButton property to do
the click of a Cancel button and accepts ESC as its key.

This can be set in the designer.

Lloyd Sheen

Craig McBeath said:
Can I set a procedure to be run from a keystroke in a VB.NET web application?
For instance, I would like the submit button of a form to be clicked when
the user hits the enter key. I have other user controls on the form with
buttons inside of them, and the first button in the user control always gets
clicked. I remember coming across this before, but do not remember if it
was for web application use.
 
Back
Top