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.
 
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
 
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.
 
Back
Top