By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,889 Members | 1,358 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,889 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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.