Default Form Button Focus

L

Lloyd Taylor

Hello,

This is a very trivial problem, however it is vexing me. Any help would be
gratefully received.

I have a form, with a textfield and a few buttons, the functionality I want
to give the user is once they have finished
typing their query in the text box, when the press return enter a default
button (say submit) is pressed.

However I can't get the button into focus so what they have to do currently
is physically click on the button.

Is there a way I can set focus on the button to automatically to accept the
user pressing the enter key?

Thanks
 
O

Oriol

Just assign the AcceptButton property to the button:

this.acceptbutton = this.btnClose

For example.

Bye!
Oriol
 
H

Herfried K. Wagner [MVP]

* "Lloyd Taylor said:
This is a very trivial problem, however it is vexing me. Any help would be
gratefully received.

I have a form, with a textfield and a few buttons, the functionality I want
to give the user is once they have finished
typing their query in the text box, when the press return enter a default
button (say submit) is pressed.

However I can't get the button into focus so what they have to do currently
is physically click on the button.

Is there a way I can set focus on the button to automatically to accept the
user pressing the enter key?

Assign the button to the form's 'AcceptButton' property. Note that you
can specify a cancel button too ('CancelButton').
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top