Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: How to determine which control has focus


Message #1 by "Mark Phillips" <mark@p...> on Tue, 26 Nov 2002 01:57:11
Hello Mark,

well, the active control in FormA should not change unless
you do something in FormB to modify it. If you indeed do so,
because you show FormB as modal, just reset the focus to
the component that had the focus before showing it.
In FormA, your code should be like:

Private Sub mnuMy_Click()
    On error resume next 'just in case
    Dim ctrl As Control
    Set ctrl = Me.ActiveControl
    FormB.Show vbModal
    ctrl.SetFocus
End Sub


Marco  

  Return to Index