Using a multiline text box for logging

Just a quick note… if you have a winforms app, you can log what is happening to a multiline textbox (normally set to readonly). To ensure that the last message added is visible, run code as follows everytime you add a log message.

textBoxMessages.Text += string.Format("{0}\r\n", aMessage);
textBoxMessages.SelectionStart = textBoxMessages.Text.Length - 1;
textBoxMessages.ScrollToCaret();

You May Also Like

About the Author: rnowik

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.