title: Can't set focus on a Windows Forms textbox
body: <p>I can't seem to get input focus on a textbox when a tab page first comes up (I'm using Windows Forms, VB.NET 3.5).</p>
  
  <p>I have a textbox on a panel on a tab page, and I want the focus to be on the textbox when the tab page comes up. I want the user to be able to start typing immediately in the focused textbox without having to click on the textbox. I have tab stops set in the order I want and the textbox is the first tab stop. The tab stops work except that when the tab page comes up the focus is not on the textbox, i.e. the one that's first in the tab order. </p>
  
  <p>In the Enter event handler of the tab page I call the Focus method of the text box, but it returns False and does nothing, no error messages.  I know I can access the text box because 
  at the same point in the code I can set the text of the text box.</p>
  
  <p>If it matters, the layout of the tab page is a little complicated:</p>
  
  <pre><code>frmFoo/TabControl1/TabPageX/Panel1/Panel2/TextBox1
  </code></pre>
  
  <p>I want to set the focus on TextBox1.  </p>
  
  <ol>
  <li>What's the best way to get the focus on the desired textbox?</li>
  <li>If setting focus is the best way, why is the textbox.Focus() method failing?</li>
  </ol>