Solved

VB.NET - Howto give a TextBox keyboard focus

Posted on 2003-11-13
3
1,917 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

Monthly Recap

May was a big month for new releases from Linux Academy! Take a look at what our team built recently in our blog. You can access the newest releases from our blog.

Question has a verified solution.

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

A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

696 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