Click here to Skip to main content
15,896,408 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C#
private void button1_Click(object sender, EventArgs e)
       {
           Console.WriteLine("LOWER LEFT TRIANGLE");

           for (int i = 0; i <= 5; i++)
           {
               for (int j = 0; j < i; j++)
               {
                   MessageBox.Show("*");
                   //Console.Write("*");
               }
               Console.WriteLine();
           }

       }
Posted

1 solution

MessageBox's Show method receives a string to display, so you have to put your stars into a string (including new-line) and send it to the method...
Something like this...
C#
string sz = "";
for (int i = 0; i <= 5; i++)
{
  for (int j = 0; j < i; j++)
  {
    sz += "*";
  }
  sz += Environment.NewLine;
}
MessageBox.Show(sz);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900