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

Scroll To Bottom Of RichTextBox

P: n/a
How do I scroll to the bottom of RichTextBox

Currently tried


This does not work.

What is the best what to accomplish this


Nov 21 '05 #1
Share this Question
Share on Google+
1 Reply

P: n/a
* "Daniel Friend" <da*> scripsit:
How do I scroll to the bottom of RichTextBox

From my FAQ (<URL:>):

When using a RichTextBox control for displaying logging information, it is
useful to scroll the recently added line into view. There are two ways to
accomplish this:

Private Const WM_VSCROLL As Int32 = &H115
Private Const SB_BOTTOM As Int32 = 7

Private Declare Auto Function SendMessage Lib "user32.dll" ( _
ByVal hwnd As IntPtr, _
ByVal wMsg As Int32, _
ByVal wParam As Int32, _
ByVal lParam As Int32 _
) As Int32

Private Sub AddLine(ByVal Destination As RichTextBox, ByVal Text As String)
With Destination
.AppendText(Text & ControlChars.NewLine)
SendMessage(Destination.Handle, WM_VSCROLL, SB_BOTTOM, 0)
End With
End Sub

- or -

Dim ctr As Control = Me.ActiveControl
With Me.RichTextBox1
.AppendText("Hello World!")
End With

The 2nd solution has a side-effect: Setting the focus to the
RichTextBox control may raise validation events.

Herfried K. Wagner [MVP]
Nov 21 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.