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 Controls / October 2008

Tip: Looking for answers? Try searching our database.

Textbox With Long Entry Displays Right-Most Part Rather Than Left-

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
GL-DSHS - 22 Sep 2008 20:00 GMT
In VS 2005, textboxes that are not long enough to display all of their text
data will automatically scroll as you reach the right edge of the textbox,
and let you continue entering text, scrolling the leftmost part of the text
off the left side of the textbox.  This is Good.  
But
When you tab out of the textbox, it keeps displaying the Right-Most part of
the text, rather than re-adjusting the text (snap back) so that the Left-Most
part is displayed.  

Is this really the way that VS 2005 TextBoxes are designed?  How can I make
them "snap back" after the user tabs or mouses out of the textbox?

Thanks for any help.
-Gary
GL-DSHS - 26 Sep 2008 19:31 GMT
I found a work-around.  I was hoping for a general setting, but could not
find one.  I had to deal with each textbox individually:

Use LostFocus event handler, include all TextBoxes in question:
Sub txtTitle_LostFocus (ByVal sender As Object, _ ByVal e As
System.EventArgs) _
 Handles txtTitle.LostFocus, _
           txtFName.LostFocus, _ etc
 DirectCast(sender,TextBox).SelectionStart = 0
 DirectCast(sender,TextBox).SelectionLength = 0
End Sub

> In VS 2005, textboxes that are not long enough to display all of their text
> data will automatically scroll as you reach the right edge of the textbox,
[quoted text clipped - 10 lines]
> Thanks for any help.
> -Gary
Jeff Johnson - 07 Oct 2008 20:09 GMT
>I found a work-around.  I was hoping for a general setting, but could not
> find one.  I had to deal with each textbox individually:

You could have derived from TextBox and overridden OnLostFocus to get this
behavior and then used this new class for all your text boxes.

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.