When using a textbox or richtextbox control for displaying logging information, it is useful to scroll the recently added line into view. There are two ways to accomplish this (the first solution will also work with textbox controls and supports scrolling to the top too).
Vertical scrolling only works with multi-line textboxes (the MultiLine property must be set to True), and horizontal scrolling requires the WordWrap property to be set to False:
Usage:
— or —
The richtextbox control provides a ScrollToCaret method that can be used to scroll the control to the caret position. However, this approach might have side-effects because setting the focus to the control may raise validation events: