Solved

VB.NET - Howto give a TextBox keyboard focus

Posted on 2003-11-13
3
1,912 Views
Last Modified: 2008-03-10
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.  
0
Comment
Question by:scottiesi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 4

Accepted Solution

by:
brother7 earned 50 total points
ID: 9745243
That's correct.  If the first TextBox is TestBox1, then
   TextBox1.Focus()
will give it focus.
0
 
LVL 27

Expert Comment

by:planocz
ID: 9749411
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
 
LVL 27

Expert Comment

by:ddrudik
ID: 13603714
Sorry, but that doesn't necessarily give a textbox focus, to do so you would need to use:

    TextBox1.Select()

Thanks.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question