How would you change the PushCounterPanel class so that instead of displaying a count of how many times the button was pushed, it displays a count "trail"?
a.After one push, it displays "01";
b.after two pushes, it displays "012";
c.after five pushes, it displays "012345"; and so on.

Respuesta :

Answer:

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using System.Windows.Forms;

namespace WindowsFormsApp1

{

   public partial class Form1 : Form

   {

       int count = 0;

       string countInfo = "0" ;

       string info = "";

       string newline = Environment.NewLine;

       public Form1()

       {

           InitializeComponent();

           label1.Text = count.ToString();

       }

       private void button1_Click(object sender, EventArgs e)

       {

           //push counter

           count += 1;

           //add the new push to the previous count

           countInfo = countInfo  + count.ToString();

           //add the new puch trail to all trails with newline  

           info = info + countInfo + newline ;

           label1.Text = info;

       }

   }

}

Explanation:

Application designed using Desktop App for c#.

Ver imagen oyindolapokomolafe