Autoscroll in C# RichTextBox

using System.Runtime.InteropServices;
#region WinAPI
//WinAPI-Declaration for SendMessage
public static extern IntPtr SendMessage(
IntPtr window, int message, int wparam, int lparam);
const int WM_VSCROLL = 0x115;
const int SB_BOTTOM = 7;
SendMessage(richTextBox1.Handle, WM_VSCROLL, SB_BOTTOM, 0);


  1. That is a much better solution than the ScrollToCaret() method that many people use.

    I have wrapped it in a class for people that are unfamiliar with the whole WinAPI thing.


Post a Comment

Popular posts from this blog

Parse XML to dynamic object in C#

C# Updating GUI from different thread