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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top