user208204 user208204 - 2 months ago 6
C# Question

How do I get this message box to properly put each sentence on their own line with C#?

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

Answer

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.");
}