472,102 Members | 1,361 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,102 software developers and data experts.

Trying to force a vertical scrollbar to the "Bottom".

Hello Everyone,

Fairly new to c# here and have a question regarding scrollbars,
particularly a vertical scrollbar.

It looks like my options are restricted for the textbox scrollbars
being that I can enable vertical or horizontal scrollbars for the
textbox and their wrapping but thats it for modifications of the
scrollbar.

I'm trying to figure out a way to force a textbox vertical scrollbar
to the bottom, even after the textbox update with more data.

Right now i append data to a textbox and when the visible section of
the textbox goes beyond the screen area, each following textbox update
makes the scrollbar reset to the very top again. This only happens if
the user moved the scrollbar down before another update occurs.

I want to force that sucker to the bottom. Can i do something to force
its location perhaps in an event or somewhere?

-Buht
Nov 16 '05 #1
3 9758
buht wrote:
Hello Everyone,

Fairly new to c# here and have a question regarding scrollbars,
particularly a vertical scrollbar.

It looks like my options are restricted for the textbox scrollbars
being that I can enable vertical or horizontal scrollbars for the
textbox and their wrapping but thats it for modifications of the
scrollbar.

I'm trying to figure out a way to force a textbox vertical scrollbar
to the bottom, even after the textbox update with more data.

Right now i append data to a textbox and when the visible section of
the textbox goes beyond the screen area, each following textbox update
makes the scrollbar reset to the very top again. This only happens if
the user moved the scrollbar down before another update occurs.

I want to force that sucker to the bottom. Can i do something to force
its location perhaps in an event or somewhere?

-Buht


Change the selection to the end of the text (length of the text + 1) and
that should do it.

textBox.SelectionStart = textBox.Text.Length;
textBox.SelectionLength = 0;

Try that.

Darwen.
Nov 16 '05 #2
David McClarnon <dm********@ntlworld.com> wrote in message news:<co****************@newsfe5-win.ntli.net>...
buht wrote:
Hello Everyone,

Fairly new to c# here and have a question regarding scrollbars,
particularly a vertical scrollbar.

It looks like my options are restricted for the textbox scrollbars
being that I can enable vertical or horizontal scrollbars for the
textbox and their wrapping but thats it for modifications of the
scrollbar.

I'm trying to figure out a way to force a textbox vertical scrollbar
to the bottom, even after the textbox update with more data.

Right now i append data to a textbox and when the visible section of
the textbox goes beyond the screen area, each following textbox update
makes the scrollbar reset to the very top again. This only happens if
the user moved the scrollbar down before another update occurs.

I want to force that sucker to the bottom. Can i do something to force
its location perhaps in an event or somewhere?

-Buht


Change the selection to the end of the text (length of the text + 1) and
that should do it.

textBox.SelectionStart = textBox.Text.Length;
textBox.SelectionLength = 0;

Try that.

Darwen.

Doesnt seem to be working. I set both of those member values to what
you recommended in the constructor of the form and its textbox. Then i
created a separate function to call after each update of my textbox
data with thosee values to try to force the location again.

I also turned off hideselection to be sure. Hrm...
Nov 16 '05 #3
bu******@gmail.com (buht) wrote in message news:<1f**************************@posting.google. com>...
David McClarnon <dm********@ntlworld.com> wrote in message news:<co****************@newsfe5-win.ntli.net>...
buht wrote:
Hello Everyone,

Fairly new to c# here and have a question regarding scrollbars,
particularly a vertical scrollbar.

It looks like my options are restricted for the textbox scrollbars
being that I can enable vertical or horizontal scrollbars for the
textbox and their wrapping but thats it for modifications of the
scrollbar.

I'm trying to figure out a way to force a textbox vertical scrollbar
to the bottom, even after the textbox update with more data.

Right now i append data to a textbox and when the visible section of
the textbox goes beyond the screen area, each following textbox update
makes the scrollbar reset to the very top again. This only happens if
the user moved the scrollbar down before another update occurs.

I want to force that sucker to the bottom. Can i do something to force
its location perhaps in an event or somewhere?

-Buht


Change the selection to the end of the text (length of the text + 1) and
that should do it.

textBox.SelectionStart = textBox.Text.Length;
textBox.SelectionLength = 0;

Try that.

Darwen.

Doesnt seem to be working. I set both of those member values to what
you recommended in the constructor of the form and its textbox. Then i
created a separate function to call after each update of my textbox
data with thosee values to try to force the location again.

I also turned off hideselection to be sure. Hrm...


I wanted to follow-up.. With the help of a fellow co-worker I
discovered that one thing was missing with the above to statements...
the textbox.scrolltocaret() function. Though my cursor was moving with
the above two statements, the scrollbar was not. Adding that
additional method to the two statements moves the attached bar to the
newly located cursor.

Thanks for your help!

Buht
Nov 16 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Sean Berry | last post: by
2 posts views Thread by Sean Berry | last post: by
3 posts views Thread by Gianni Rondinini | last post: by
7 posts views Thread by Lyle Fairfield | last post: by
2 posts views Thread by Stephen Plotnick | last post: by
reply views Thread by =?Utf-8?B?YmFtbm9sYQ==?= | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.