Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3598846
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T20:17:37+00:00 2026-05-18T20:17:37+00:00

I have a textbox (textBox1 as an example) to which i’m periodically appending a

  • 0

I have a textbox (textBox1 as an example) to which i’m periodically appending a character (every second or so). I wish to make it so that when the text gets too long to fit in the textbox the overflow will actually go towards the left of the textbox even when it’s not focused instead of the normal behaviour which is to the right, this way the last character will always be shown.
The way I’ve done it is when I’m adding the character i’m also doing:

textBox1.ScrollToHorizontalOffset(textBox1.GetRectFromCharacterIndex(textBox1.Text.Length).Right);

This works nicely until the length of the text gets long enough. After this point scrolling will just stop and the current left overflow will remain, but new overflow will go to the right of the textbox.
For testing I’m writing the current text’s length and textBox1.GetRectFromCharacterIndex(textBox1.Text.Length).Right to console on every update:

...
Length: 22
Rect.Right: 81.99
Length: 23
Rect.Right: 85.4
Length: 24
Rect.Right: 88.81
Length: 25
Rect.Right: 91.41
Length: 26
Rect.Right: 91.41
Length: 27
Rect.Right: 91.4099999999999
Length: 28
Rect.Right: 91.4099999999999
Length: 29
Rect.Right: 91.4099999999999
Length: 30
Rect.Right: 91.4099999999999
...
Length: 47
Rect.Right: 91.4099999999999
Length: 48
Rect.Right: 91.4099999999999
Length: 49
Rect.Right: 91.4099999999999
Length: 50
Rect.Right: 91.4099999999999
Length: 51
Rect.Right: 91.4099999999999
Length: 52
Rect.Right: 92.88
Length: 53
Rect.Right: 94.8199999999999
Length: 54
Rect.Right: 96.29
Length: 55
Rect.Right: 98.2299999999999
Length: 56
Rect.Right: 99.7
Length: 57
Rect.Right: 101.64

Before Text.Length is 25 the textbox is still wide enough to fit everything. After this point the text doesn’t fit anymore and the scrolling works up until the length is 52.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T20:17:37+00:00Added an answer on May 18, 2026 at 8:17 pm

    That behaviour is odd — I reproduced the same.

    I got the effect for which you are looking by instead using

    textbox1.ScrollToHorizontalOffset(double.MaxValue);
    

    Since you want to scroll all the way right, there is no harm in passing a value greater than the actual location of the character.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For example, If I have a textbox with runat=server on a page, The value
I have three TextBox controls on the page <asp:TextBox ID=TextBox1 runat=server AutoPostBack=True OnTextChanged=TextBox_TextChanged TabIndex=1>
I have a textbox with the Text property bound to a dataset column with
I have a textbox and a link button. When I write some text, select
I have a textbox where i want to have an autocomplete that lets the
In my application I have TextBox in a FormView bound to a LinqDataSource like
I have a textbox whose input is being handled by jQuery. $('input.Search').bind(keyup, updateSearchTextbox); When
I have a textbox with an onchange event. Why does this event not fire
I have a TextBox control on my Form. I use the Leave event on
I have 2 textbox in my asp.net page and also have one hiddenfield in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.