0
        private void button5_Click(object sender, EventArgs e)
    {
        MessageBox.Show("In order to bet 'High' press the 'ALT' Key and the 'H' key at the same time." + "In order to bet 'Low' press the 'ALT' Key and the 'L' key at the same time." + "In order to reduce the bet's value in half  press the 'ALT' Key and the 'H' key at the same time.");
    }

This is what it looks like now.

enter image description here

user208204
  • 23
  • 3

3 Answers3

3

Try using \n characters for each newline.

private void button5_Click(object sender, EventArgs e)
{
    MessageBox.Show(
    "In order to bet 'High' press the 'ALT' Key and the 'H' key at the same time.\n" + 
    "In order to bet 'Low' press the 'ALT' Key and the 'L' key at the same time.\n" + 
    "In order to reduce the bet's value in half  press the 'ALT' Key and the 'H' key at the same time.");
}
Michael S. Scherotter
  • 10,715
  • 3
  • 34
  • 57
1

try this

 {MessageBox.Show("In order to bet 'High' press the 'ALT' Key and the 'H' key at the same time." + Environment.NewLine 
  + "In order to bet 'Low' press the 'ALT' Key and the 'L' key at the same time." + Environment.NewLine 
  + "In order to reduce the bet's value in half  press the 'ALT' Key and the 'H' key at the same time."); }
Esperento57
  • 16,521
  • 3
  • 39
  • 45
  • why not just '\n' wherever a new line is needed? – Lodestone6 Oct 09 '16 at 04:42
  • 1
    its the same and its not the same... Its a Platform question ... Environment.Newline work on all environment (Unix or Windows). Read that http://stackoverflow.com/questions/1015766/difference-between-n-and-environment-newline – Esperento57 Oct 09 '16 at 04:44
  • ah cool, thanks for the link! – Lodestone6 Oct 09 '16 at 04:56
  • @Esperento57 Actually, there is a difference on `MessageBox`. See, when copying the message box into to clipboard (using Ctrl+C; a rather obscure but very neat feature), it will specifically replace all `\n` characters in the text with the full `Environment.NewLine`. This seems like a very clear platform independence decision. But if you start with putting platform dependent breaks in the original text, this messes up. On Windows, this causes all resulting line breaks to be `\r\r\n` instead of `\r\n`. – Nyerguds Feb 02 '18 at 11:26
1

you can to this too:

        List<string> ListMessage = new List<string>();
        ListMessage.Add("In order to bet 'High' press the 'ALT' Key and the 'H' key at the same time.");
        ListMessage.Add("In order to bet 'Low' press the 'ALT' Key and the 'L' key at the same time.");
        ListMessage.Add("In order to reduce the bet's value in half  press the 'ALT' Key and the 'H' key at the same time.");

        //Solution 1
        MessageBox.Show(string.Join(Environment.NewLine, ListMessage));

        //Solution 2 => Add using System.Linq
        MessageBox.Show(ListMessage.Aggregate((x, y) => x + Environment.NewLine + y));
Esperento57
  • 16,521
  • 3
  • 39
  • 45