title: Trying to update one textbox from another and vice-versa C# Winforms
body: <p>I have two textboxes on a Winform. The idea is to enter Fahrenheit in one box and have it present Celcius in the other as the user types, and vice versa.</p>
  
  <p>I have it working fine using the 'Leave' method of the textbox but I was trying to use the TextChanged method to avoid having to click or press a button for the result.</p>
  
  <p>The problem I have now is that when the first character is processed the focus moves to the second box, which fires the TextChanged method.</p>
  
  <p>I've tried using the sender to enable an if() but the sender is now the destination box.</p>
  
  <p>Any thoughts, please?</p>
  
  <pre><code>       private void TB_Fahrenheit_TextChanged(object sender, EventArgs e)
      {
  
          float C, F;
  
          if (TB_Fahrenheit.Text != "")
          {
              if (float.Parse(TB_Fahrenheit.Text) &lt; 1.0F)
              {
                  TB_Fahrenheit.Text = "0" + TB_Fahrenheit.Text;
              }
  
              F = float.Parse(TB_Fahrenheit.Text);
              C = ((F - 32) * 5) / 9;
              TB_Celcius.Text = C.ToString();
          }
  
      }
  
      private void TB_Celcius_TextChanged(object sender, EventArgs e)
      {
          float C, F;
          string SentBy = ((TextBox)sender).Name;
  
          MessageBox.Show(SentBy);
          return;
  
          if(SentBy != TB_Fahrenheit.Text)
          {
  
          if (TB_Celcius.Text != "")
          {
              if (float.Parse(TB_Celcius.Text) &lt; 1.0F)
              {
                  TB_Celcius.Text = "0" + TB_Celcius.Text;
              }
  
              C = float.Parse(TB_Celcius.Text);
              F = ((C * 9) / 5) + 32;
              TB_Fahrenheit.Text = F.ToString();
          }
          }
  
      }
  
      private void TB_Celcius_Enter(object sender, EventArgs e)
      {
          TB_Celcius.Clear();
          TB_Fahrenheit.Clear();
      }
  
      private void TB_Fahrenheit_Enter(object sender, EventArgs e)
      {
          TB_Celcius.Clear();
          TB_Fahrenheit.Clear();
      }
  </code></pre>