Windows Forms Topics include: windows forms, controls, components and designers

Go Back  Xtreme .NET Talk > .NET > Windows Forms > VB6 code to VB.net .Selstart and .SelLength


Reply
 
Thread Tools Display Modes
  #1  
Old 11-02-2002, 04:59 PM
bradl45 bradl45 is offline
Newcomer
 
Join Date: Nov 2002
Posts: 3
bradl45 is on a distinguished road
Unhappy VB6 code to VB.net .Selstart and .SelLength



Here is some code I use to high light a textbox when a user needs to re-enter data into a textbox, it works great in vb6 but not in .Net. Does anyone know what methods I would use in .Net to preform the same action.

txtname.Setfocus
txtname.Selstart = 0
txtname = Len(txtName.Text)



Thanks

Brad
SLC, Utah
Reply With Quote
  #2  
Old 11-02-2002, 05:05 PM
Volte Volte is offline
Neutiquam Erro

Preferred language:
C# and VB.NET
 
Join Date: Nov 2002
Posts: 2,172
Volte is on a distinguished road
Default

Try this:

Code:
txtName.Focus()
txtName.Select(0, txtName.Text.Length)
Reply With Quote
  #3  
Old 11-03-2002, 09:46 PM
bradl45 bradl45 is offline
Newcomer
 
Join Date: Nov 2002
Posts: 3
bradl45 is on a distinguished road
Default

Thanks for the help

Brad
Reply With Quote
  #4  
Old 11-03-2002, 09:55 PM
Volte Volte is offline
Neutiquam Erro

Preferred language:
C# and VB.NET
 
Join Date: Nov 2002
Posts: 2,172
Volte is on a distinguished road
Default

I just realized you can shorten that last line down to txtName.SelectAll,
but the other way will work too.
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Upgrade code from VB6 to VB.NET solartorch General 0 01-23-2007 01:07 AM
Using an old VB6 ActiveX Control or Code Component in VB.NET Georgen Interoperation / Office Integration 10 02-02-2005 11:45 AM
transposing VB6 palette code to .NET davidrobin Graphics and Multimedia 0 04-19-2004 03:22 AM
Can I develop VB6 compatible code in .NET IDE? cam292 General 5 01-30-2004 03:15 PM
calling code, from vb6 to .net? Winston Windows Forms 2 04-04-2003 08:12 AM

Advertisement:







Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe