Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / January 2008

Tip: Looking for answers? Try searching our database.

Focus at the right spot

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Arne Garvander - 25 Jan 2008 22:17 GMT
I use
Mytextbox.text = "Default"
mytextbox.focus

How do I focus on the first character in the text box?

Signature

Arne Garvander
Certified Geek
Professional Data Dude

BlackWasp - 26 Jan 2008 11:59 GMT
You need to change the selection within the textbox.  This is done with the
SelectionStart and SelectionLength properties.  The start is the start
position for selection, the length is the number of characters to be
selected from that point or zero for no selection, just your flashing
cursor.  For example, the following code moves the cursor to just after the
fifth character in the textbox.

           textBox1.SelectionStart = 5;
           textBox1.SelectionLength = 0;

Signature

BlackWasp
www.blackwasp.co.uk

>I use
> Mytextbox.text = "Default"
> mytextbox.focus
>
> How do I focus on the first character in the text box?
Herfried K. Wagner [MVP] - 26 Jan 2008 18:51 GMT
"BlackWasp" <nospam@please> schrieb:
> You need to change the selection within the textbox.  This is done with
> the SelectionStart and SelectionLength properties.

... or via the control's parameterized 'Select' method.

Signature

M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://dotnet.mvps.org/dotnet/faqs/>

BlackWasp - 26 Jan 2008 21:25 GMT
Good point!  :-)

I happened to be working on a form where I was reading the selection
position from a textbox at the time.  I guess it was in mind!

Signature

BlackWasp
www.blackwasp.co.uk

> "BlackWasp" <nospam@please> schrieb:
>> You need to change the selection within the textbox.  This is done with
>> the SelectionStart and SelectionLength properties.
>
> ... or via the control's parameterized 'Select' method.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.