title: Bubble Sort using C# windows application form how to clear label.text every button click
body: <p>Hi guys every time I pressed the button to generate the sorted string the output gets concatenated in the previous label output. I'm lost on how to clear the previous output on the label before showing the new one here's my code.</p>
  <pre><code>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 You_Source
  {
  public partial class Form1 : Form
  {
      string method;
  
      public Form1()
      {
          InitializeComponent();
      }
  
      private void radio_checked(object sender, EventArgs e)
      {
          RadioButton radio = (RadioButton)sender;
          method = radio.Text;
          //label_Output.Text = method;
      }
  
      private void button_Sort_Click(object sender, EventArgs e)
      {
          string input = textBox_Input.Text;
          label_Output.Clear();
          if ( method == &quot;Bubble Sort&quot;)
          {
              char[] charInput = input.ToCharArray();
              char temp;
  
              for (int j = 0; j &lt;= charInput.Length - 2; j++)
              {
                  for (int i = 0; i &lt;= charInput.Length - 2; i++)
                  {
                      if (charInput[i] &gt; charInput[i + 1])
                      {
                          temp = charInput[i + 1];
                          charInput[i + 1] = charInput[i];
                          charInput[i] = temp;
                      }
                  }
              }
              foreach (char letter in charInput)
                  label_Output.Text = label_Output.Text+letter;
          }
      }
  }
  </code></pre>
  <p>can anyone give me a hint on what to do.
  example( if i enter &quot;cba&quot; the output would be &quot;abc&quot;, then when i entered another input in the text box &quot;zyx&quot; the new label output would be &quot;abcxyz&quot;. I just one the new one &quot;xyz&quot; to be shown.</p>