Groups | Blog | Home
all groups > dotnet windows forms databinding > october 2005 >

dotnet windows forms databinding : Change focus


Mervin Williams
10/18/2005 8:18:07 PM
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

Mervin Williams
10/18/2005 8:46:05 PM
Thanks, that was the answer!


[quoted text, click to view]

Tim Wilson
10/18/2005 9:27:32 PM
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

[quoted text, click to view]

Herfried K. Wagner [MVP]
10/19/2005 2:18:04 PM
"Mervin Williams" <mwilliams@innovasolutions.net> schrieb:
[quoted text, click to view]

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/>
AddThis Social Bookmark Button