Checking focus status

  • Thread starter Thread starter John
  • Start date Start date
J

John

Hi

I have two list controls on a form with a couple of buttons. I need to know
which list is currently highlighted by user so when the user presses a
button I know which list to process. How do I find which list is currently
selected/highlighted?

Thanks

Regards
 
John said:
Hi

I have two list controls on a form with a couple of buttons. I need to know
which list is currently highlighted by user so when the user presses a
button I know which list to process. How do I find which list is currently
selected/highlighted?

Thanks

Regards

Screen.PreviousControl

should do the trick.

HTH
Matthias Kläy
 
John said:
Hi

I have two list controls on a form with a couple of buttons. I need
to know which list is currently highlighted by user so when the user
presses a button I know which list to process. How do I find which
list is currently selected/highlighted?

Thanks

Regards

Screen.PreviousControl will tell you the control that had focus right before the
button acquired it. Are there any other controls that can have focus on the
form besides the two ListBoxes and the buttons? Even with just those four the
user might go from one button to the other. You might need to set a variable in
the GotFocus event of the two ListBoxes and then test that value.
 

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