473,322 Members | 1,494 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Need TextBox to scroll to where the text is appended?

Hi,

I am using TextBox1.AppendText, but I want the view to always be scrolled
to the very bottom. Any ideas?
Nov 21 '05 #1
10 1208
<cooles> schrieb:
I am using TextBox1.AppendText, but I want the view to always be scrolled
to the very bottom. Any ideas?


Adding a line to a richtextbox and scrolling it into view
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=richtextboxscrolltobottom&lang=en>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #2
cooles,

TextBox1.SelectionStart = TextBox1.Text.Length

Kerry Moorman
"cooles" wrote:
Hi,

I am using TextBox1.AppendText, but I want the view to always be scrolled
to the very bottom. Any ideas?

Nov 21 '05 #3
I believe AppendText() itself will scroll to the end. If not,

TextBox1.SelectionStart = TextBox1.TextLength
TextBox1.ScrollToCaret()

<cooles> wrote in message news:%2****************@TK2MSFTNGP14.phx.gbl...
Hi,

I am using TextBox1.AppendText, but I want the view to always be scrolled
to the very bottom. Any ideas?

Nov 21 '05 #4
None worked for me, this is what I have

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

TextBox1.Clear()

Dim lstr() As Integer = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9}

For Each item As Integer In lstr

TextBox1.AppendText(item & ControlChars.NewLine)

Next

TextBox1.Focus()

TextBox1.Select(TextBox1.Text.Length - 3, 1)

TextBox1.ScrollToCaret()

End Sub

also, textbox1 is multiline=true and

scrollbars=both


Nov 21 '05 #5
Don't put it in the Load event.
<cooles> wrote in message news:up**************@TK2MSFTNGP10.phx.gbl...
None worked for me, this is what I have

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

TextBox1.Clear()

Dim lstr() As Integer = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6,
7, 8, 9}

For Each item As Integer In lstr

TextBox1.AppendText(item & ControlChars.NewLine)

Next

TextBox1.Focus()

TextBox1.Select(TextBox1.Text.Length - 3, 1)

TextBox1.ScrollToCaret()

End Sub

also, textbox1 is multiline=true and

scrollbars=both


Nov 21 '05 #6
> Don't put it in the Load event.

Where should I put it, I don't have any buttons on my form,
i.e no click events?
Nov 21 '05 #7
Try this

Protected Overrides Sub OnActivated(ByVal e As System.EventArgs)
MyBase.Activate()
TextBox1.ScrollToCaret()
End Sub

HTH, Phil
<dion> wrote in message news:u$*************@tk2msftngp13.phx.gbl...
Don't put it in the Load event.


Where should I put it, I don't have any buttons on my form,
i.e no click events?

Nov 21 '05 #8
Don't put it in the Load event.
<cooles> wrote in message news:up**************@TK2MSFTNGP10.phx.gbl...
None worked for me, this is what I have

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

TextBox1.Clear()

Dim lstr() As Integer = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6,
7, 8, 9}

For Each item As Integer In lstr

TextBox1.AppendText(item & ControlChars.NewLine)

Next

TextBox1.Focus()

TextBox1.Select(TextBox1.Text.Length - 3, 1)

TextBox1.ScrollToCaret()

End Sub

also, textbox1 is multiline=true and

scrollbars=both


Nov 21 '05 #9
> Don't put it in the Load event.

Where should I put it, I don't have any buttons on my form,
i.e no click events?
Nov 21 '05 #10
Try this

Protected Overrides Sub OnActivated(ByVal e As System.EventArgs)
MyBase.Activate()
TextBox1.ScrollToCaret()
End Sub

HTH, Phil
<dion> wrote in message news:u$*************@tk2msftngp13.phx.gbl...
Don't put it in the Load event.


Where should I put it, I don't have any buttons on my form,
i.e no click events?

Nov 21 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Alex Moskalyuk | last post by:
I am using System.Windows.Forms.TextBox to publish some real-time data that's coming off the external devices. My data is fed into the TextBox with proper precautions not to exceed the MaxSize...
5
by: Wilfried Mestdagh | last post by:
Hello, textBox += someData + "\r\n"; does not scroll the visible text to the end. How do I perform that ? Also this way seems to me a lot of reallocating memory. Is there better way to add...
5
by: pphillips | last post by:
On my webform I have a textbox. When the page loads I put some text in the textbox. The text is 2 sentences and all I want to do is to put the sentences on different lines. It use to be so...
3
by: Chris | last post by:
Hi, I have a parent page that loads a popup and when the OK button is press it pass the value back to the parent form textbox. It passes the value but it doesn't close the popup but also open...
6
by: simonc | last post by:
Is there a way of locking the display of two text boxes, so that as you scroll down in one text box the display is automatically scrolled in the other? The issue is to display line numbers for a...
3
by: Materialised | last post by:
Ok, I have trawled google groups for the last hour, and have found no >net work around to my issue. Basically my problem is a simple one. I have a multiline textbox and a command button. When...
13
by: WALDO | last post by:
I have a .Net TextBox (TextBoxBase, really) in which I am appending about 20 lines of text per second. I use the AppendText() method to accomplish this. This is a great substitute for taking the...
1
by: John L. | last post by:
How do I invoke the scroll() method of a window object for a scrollable IFRAME element in an HTML document? I am using IE 7.0, and I thought the following would work: ...
8
by: fniles | last post by:
I am using VB.NET 2008. I would like to search a textbox (find next and find previous), and when it finds the text, move my cursor in the textbox to where the found text is. How can I do that ?...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.