I have a form with a datagrid and two buttons on it. Upon opening the form,
focus goes immediately to the datagrid. How do I set focus onto one of the
buttons. I've tried to use "btnSave.Focus()", but to no avail.

Please help.

Mervin Williams

Re: Change focus by Tim

Tim
Tue Oct 18 20:27:32 CDT 2005

Try setting the TabIndex property on the controls to appropriate values, and
ensure that the TabStop property is set to "true" for any controls that
should be hit while tabbing.

--
Tim Wilson
.NET Compact Framework MVP

"Mervin Williams" <mwilliams@innovasolutions.net> wrote in message
news:%23jRsSrE1FHA.2312@TK2MSFTNGP14.phx.gbl...
> I have a form with a datagrid and two buttons on it. Upon opening the
form,
> focus goes immediately to the datagrid. How do I set focus onto one of
the
> buttons. I've tried to use "btnSave.Focus()", but to no avail.
>
> Please help.
>
> Mervin Williams
>
>



Re: Change focus by Mervin

Mervin
Tue Oct 18 20:46:05 CDT 2005

Thanks, that was the answer!


"Tim Wilson" <TIM(UNDERSCORE)WILSON(AT)ROGERS(PERIOD)COM> wrote in message
news:%23Y9SlwE1FHA.3924@TK2MSFTNGP14.phx.gbl...
> Try setting the TabIndex property on the controls to appropriate values,
> and
> ensure that the TabStop property is set to "true" for any controls that
> should be hit while tabbing.
>
> --
> Tim Wilson
> .NET Compact Framework MVP
>
> "Mervin Williams" <mwilliams@innovasolutions.net> wrote in message
> news:%23jRsSrE1FHA.2312@TK2MSFTNGP14.phx.gbl...
>> I have a form with a datagrid and two buttons on it. Upon opening the
> form,
>> focus goes immediately to the datagrid. How do I set focus onto one of
> the
>> buttons. I've tried to use "btnSave.Focus()", but to no avail.
>>
>> Please help.
>>
>> Mervin Williams
>>
>>
>
>



Re: Change focus by Herfried

Herfried
Wed Oct 19 07:18:04 CDT 2005

"Mervin Williams" <mwilliams@innovasolutions.net> schrieb:
>I have a form with a datagrid and two buttons on it. Upon opening the
>form, focus goes immediately to the datagrid. How do I set focus onto one
>of the buttons. I've tried to use "btnSave.Focus()", but to no avail.

In addition to the other reply: If you do not want to change the tab order
of the controls, consider calling the button's 'Select' method instead of
its 'Focus' method.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>