0

I have several textboxes that are in tabs and would like them all to auto-scroll when text is added without bringing them to focus.

Is this possible?

Edited by buster2209: n/a

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by buster2209
0

Yes, but you'll have to use a windows function to do so. Add this where you need it

private const int WM_VSCROLL = 0x115;
private const int SB_BOTTOM = 7;

[DllImport("user32.dll", CharSet = CharSet.Auto)]
private static extern int SendMessage(IntPtr hWnd, int wMsg, IntPtr wParam, IntPtr lParam);

You can then scroll a textbox by using this call:

SendMessage(textBox2.Handle, WM_VSCROLL, (IntPtr)SB_BOTTOM, IntPtr.Zero);

Make sure you replace textBox2 with your own textbox name. You'll also need to include using System.Runtime.InteropServices;

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.