VB.NET - Howto give a TextBox keyboard focus

Hi,

When doing Windows Forms in VB.NET, and you have a bunch of TextBox controls, how do you give the first one keyboard focus?  

Do you use the method Focus( ) for this?  

Thanks.  
scottiesiAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
brother7Connect With a Mentor Commented:
That's correct.  If the first TextBox is TestBox1, then
   TextBox1.Focus()
will give it focus.
0
 
planoczCommented:
Hi scottiesi,

If you have your tabIndex setup to start it 0 on the first Textbox this will have the first focus(cursor placement) on that textbox, or you can force a focus on that textbox when you load  that form(like what brother7 was talking about).
0
 
ddrudikCommented:
Sorry, but that doesn't necessarily give a textbox focus, to do so you would need to use:

    TextBox1.Select()

Thanks.
0
All Courses

From novice to tech pro — start learning today.