Wich control has the focus ?

  • Thread starter Peter Stojkovic
  • Start date
P

Peter Stojkovic

I have the following problem

VS.2003 Visual Basic Windows XP

My Applictaion has only keyboard inputs. There is no mouse available.

Sometimes my program does not go on,
because any other control then i expected has gone focus or is activated.

So I dont know which control has focus in this moment.

Is there any tool available, so that i can see recognize the active window
and control ??


THX
Peter
 
A

Andrew McNerlin

Hello Peter,

You can use the ActiveControl property of a form (or anything which implements
the IContainerControl interface for that matter) to determine which control
is active.

Hope this helps,
Andrew McNerlin
 
H

Herfried K. Wagner [MVP]

Peter Stojkovic said:
VS.2003 Visual Basic Windows XP

My Applictaion has only keyboard inputs. There is no mouse available.

Sometimes my program does not go on,
because any other control then i expected has gone focus or is activated.

So I dont know which control has focus in this moment.

You can use the form's 'ActiveControl' property to determine the control
which is currently focused. Then you can set the focus to another control
by calling its 'Focus' or 'Select' method.
 

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

Top