Hi!

I designed a windows forms dialog with some controls on it. When it loads I
want to set the control that has the input focus when the form is displayed.
Somehow calling the Focus()-method of the control that I want to have focus
in the Form.Load-Eventhandler does not work.
Does anyone know a solution?

TIA,

Markus

--
##########################################
Please do not send replies to msdngroups@syska.de.
Mails sent to that adress will be deleted without being read.

Re: Initially focused control by Herfried

Herfried
Wed Aug 20 07:07:28 CDT 2003

Hello,
"Markus Wildgruber" <msdngroups@syska.de> schrieb:
> I designed a windows forms dialog with some controls on
> it. When it loads I want to set the control that has the input
> focus when the form is displayed. Somehow calling the
> Focus()-method of the control that I want to have focus
> in the Form.Load-Eventhandler does not work.
> Does anyone know a solution?

Set the control's TabIndex property to 0. Alternatively, you can call a
"Me.Show()" in "Sub Form_Load" and set the focus _after_ showing the form.

Regards,
Herfried K. Wagner
--
MVP · VB Classic, VB .NET
http://www.mvps.org/dotnet