UJ said:
I've got a multiline textbox that I'm using to display messages. Is there an
easy way to have it scroll to the end after I add a line to the text of the
box?
TIA - Jeff.
The only way I've found, is to use Windows messages ... Not nice but the only
solution I ever found.
using System.Runtime.InteropServices;
[DllImport("user32.dll", EntryPoint="SendMessageA")]
static extern uint SendMessage(System.IntPtr hwnd, uint wMsg, uint wParam, uint
lParam);
const int WM_VSCROLL = 0x115;
const int SB_BOTTOM = 7;
TextBox report ;
void printError(string msg)
{
...
// auto scroll to bottom of text control
SendMessage( this.report.Handle, WM_VSCROLL, SB_BOTTOM, 0);
}
cyrille