Helper routine to turn a textbox into a scrolling log/chat window.

Forms and Controls
Larry Serflaten

Version Compatibility:

More information:
This routine handles the adding of text to a textbox such that the added text is always in view. Text scrolls off the top, line by line. The MAXCHARS constant determines how many characters will be retained before scrolling off the top.

You must use a textbox that has its MultiLine property set to True, it may need a vertical scroll bar.

The code provided expects the textbox object to be passed as a parameter, followed by the new text you want displayed. If you only have one textbox in your application that needs this feature, you can simplify the calling syntax by removing the textbox parameter and substituting the name of your textbox where 'tbxEditBox' appears in the code.

The calling syntax (as provided) is as follows: Post (TextBox.Name), vbCrLf & "New text."

New text is appended to the end of the currently displayed text, the new line constant (vbCrLf) is required when a new line is desired.

Instructions: Copy the declarations and code below and paste directly into your VB project.