Thursday, October 28, 2010

How to Simulate a Click on a Button by Pressing Enter on the Keyboard In VB.Net 2008?

Hello,



I would like to know how to Simulate a Click on a Button by Pressing Enter on the Keyboard In VB.Net 2008. I am working on a web browser, and would like to know how to do this.



Thank You,

JS71296How to Simulate a Click on a Button by Pressing Enter on the Keyboard In VB.Net 2008?
If the button has the Default attribute set to True and the Window (Form) with that button has 'focus' then pressing Enter will 'click' that button.How to Simulate a Click on a Button by Pressing Enter on the Keyboard In VB.Net 2008?
You select the ';KeyPress event'; and have it check if the key pressed was the Enter key, then call the event of the button you want it to perform.
Create an event handler for the onKeyPress event of the textbox. Check whether ';Enter key'; was pressed or not. If enter was pressed, call the Button_Click event handler and let it handle. You can also check whether there is an event for enter press.

No comments:

Post a Comment