Gary,
Check the form's ActiveControl property. It will give you the focused
control. Set the propery to change the focus.
This propery is defined in the the IContianerControl interface. That means
if your form has a control that implements this interface and this control
contains the focused control the form's ActiveControl will return reference
to the container (not to the actually focused
control). Thus what you need to do is to check wheter the control in the
ActiveControl property implements IContainerControl and if so get its
ActiveControl propery and so on. Most used controls that implement this
interface are Form, UserControl and the SplitContainer. There are couple
more, but I suggest to check the docs for that.
When you want to change the focused control though, you can do it on any
level of the contianer control hierarchy. The propery setter will take care
of updating the actuall container.
Most used conteiner controls are Form and UserControl.
"Gary" <Ga**@discussions.microsoft.comwrote in message
news:C6**********************************@microsof t.com...
There are several controls in my form. How to detect currently which
control
has the forcus and set the forcus to a certain control?
Thanks,