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?

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;

That works a treat!

Thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.