Getting the focused control in the Form

  • Thread starter Thread starter Hagay Lupesko
  • Start date Start date
H

Hagay Lupesko

Hi,

I can't find a Form method that returns the current focused control in the
form.
Is there such a method?

Thanks, Hagay.
 
Hi Hagay,

something like this should do the trick.

private function GetFocusedControl() as Windows.Forms.Control

for each myControl as Windows.Forms.Control in me.Controls
if (myControl.Focused) then
return myControl
end if
next

end sub

of course you'll have to cast the return control back to it's original type
at some point.

hope this helps,

jim
 
Back
Top