title: Event to detect when a user control gains focus?
body: <p>I have a user control on a form that can spawn several non-modal child forms.  The child forms display data that the user can edit.  The user control displays a different view of the same data, and I want to be able to spawn a reload of the data if the user has made changes in one or more of the child forms.  I already have events set up to notify the user control of data changes in the child forms, but I can't figure out which event (if it exists) I should capture on the user control to determine that it has gotten focus back from the child form(s).  Is there an existing event I can use here?  </p>
  
  <p><strong>EDIT: Code sample</strong>
  (sorry, my client likes VB)  </p>
  
  <p>GotFocus only seems to fire when the UserControl is Disposed.  </p>
  
  <p>I add the control to a panel on the "main" form like this:</p>
  
  <pre><code>Dim mainControl as New MainUserControl()
  Panel1.Controls.Add(mainControl)
  mainControl.Doc = DocStyle.Fill
  mainControl.Visible = True
  mainControl.Show()
  </code></pre>
  
  <p>Then, the event handler code:</p>
  
  <pre><code>Private Sub MainUserControl_GotFocus(ByVal sender as Object, ByVal e as EventArgs) Handles Me.GotFocus
      MessageBox.Show("got focus")
  End Sub
  </code></pre>
  
  <p>Then, there's a "close" button on the user control that fires an event back to the main form, which then removes the user control from the panel and disposes it.  Only when <code>mainControl.Dispose()</code> is called does <code>GotFocus</code> fire.</p>
  
  <p><strong>EDIT 2</strong><br>
  I just tried handling the <code>Enter</code> event, but that only fires the first time and not every time the control receives focus.</p>