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

Re: Default Form Button Focus by Oriol

Oriol
Thu Jul 15 05:19:22 CDT 2004

Just assign the AcceptButton property to the button:

this.acceptbutton = this.btnClose

For example.

Bye!
Oriol

"Lloyd Taylor" <lltaylor2000@yahoo.com> escribió en el mensaje
news:eWqbZRlaEHA.2840@TK2MSFTNGP11.phx.gbl...
> 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
>
>



Re: Default Form Button Focus by hirf-spam-me-here

hirf-spam-me-here
Thu Jul 15 05:59:14 CDT 2004

* "Lloyd Taylor" <lltaylor2000@yahoo.com> scripsit:
> 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').

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>