Solved

VB.NET - Howto give a TextBox keyboard focus

Posted on 2003-11-13
3
1,906 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
3 Comments
 
LVL 4

Accepted Solution

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

Expert Comment

by:planocz
Comment Utility
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
Comment Utility
Sorry, but that doesn't necessarily give a textbox focus, to do so you would need to use:

    TextBox1.Select()

Thanks.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Normally the drop down box control found in the .Net framework tools is able to select just one data and value at a time, which is displayed on the text area.   But what if you want to have multiple values to be selected in the drop down box? As …
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now