We help IT Professionals succeed at work.

C# Message Box Text

tsmolskow
tsmolskow asked
on
Medium Priority
564 Views
Last Modified: 2012-05-05
I'm presenting the user with a Message Box in C#, I have a lot of text to add, how do I get that text to wrap, skip a line, and indent?
Comment
Watch Question

Carl TawnSenior Systems and Integration Developer
CERTIFIED EXPERT

Commented:
You can put line breaks in by using the "\n" escape sequence. Wrapping is automatic unless you force it by using \n. Not sure if you can indent text or not.
Senior Software Engineer
Commented:
Hi, use the new line and tab escape characters in your message string, e.g:

      string message = "Hello\nWorld\t!!!";
      MessageBox.Show(message);

"\n" is a new line
"\t" is a tab (use for indent)

For a list of the supported escape characters see:
http://www.peachpit.com/articles/article.asp?p=31938&seqNum=9

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
CERTIFIED EXPERT

Commented:
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.