?
Solved

VB.NET - Howto give a TextBox keyboard focus

Posted on 2003-11-13
3
Medium Priority
?
1,921 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 150 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

Major Serverless Shift

Comparison of major players like AWS, Microsoft Azure, IBM Bluemix, and Google Cloud Platform

Question has a verified solution.

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

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
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 …
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

771 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