C# Message Box Text

Posted on 2006-04-03
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?
Question by:tsmolskow
    LVL 52

    Expert Comment

    by:Carl Tawn
    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.
    LVL 18

    Accepted Solution

    Hi, use the new line and tab escape characters in your message string, e.g:

          string message = "Hello\nWorld\t!!!";

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

    For a list of the supported escape characters see:
    LVL 48

    Expert Comment


    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    Introduction                                                 Was the var keyword really only brought out to shorten your syntax? Or have the VB language guys got their way in C#? What type of variable is it? All will be revealed.   Also called…
    Article by: Ivo
    C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    This video discusses moving either the default database or any database to a new volume.

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now