currentFocus

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

in an MDI app, how do i determine which MDI child contol currently has the
focus? (from the MDI form)
 
Um, Me.ActiveMdiChild

? You really should have checked the help files or intellisense before
posting this.

Watch out for ActivateMdiChild (Activate vs Active)... AutoComplete might
have confused you.
 
Or... to answer your question more specifically
Me.ActiveMdiChild.ActiveControl
 
Guy,

If you do something from a MDI form than it has in my opinion the focus.

If it is from the MDIContainer than it can be something as

\\\
For Each frm As Form In Me.MdiChildren
If frm.Focused Then
MessageBox.Show(frm.Text)
End If
Next
////
This kind of things you can do as well from a MDIChild by adding
\\\
For each frm as Form in Me.MDIParent.MDIChildren
///

I hope this helps

Cor
 
wrong.
i spent quite a time looking at help, ActiveControl does ***not *** return
the control with the focus. if i have a user control with a number of text
boxes on a form for example it returns the user contriol ***not*** the text
box with focus
 
hi Cor, yes but which TextBox on frm has the focus? and what if the text box
is on a user control on another user control on the child form?

guy
 
thanks for the sarcasm, i spent a lot of time doing just that with no success
 
Ah yes... in which case you need to check the "type" of the active control
and then dive into it to find *its* active control.

For instance there are times if you do MDIParent.ActiveControl you actually
get a reference to one of the MDIChildren.... and you not to code for this
possibility.
 

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