title: C# wpf textbox while
body: <p>I am making a WPF program to determine how many hours it takes to make a certain amount of bread.</p>
  
  <p>I need the user to enter</p>
  
  <ul>
  <li>The amount of bread they want made</li>
  <li>The capacity they can create bread per hour</li>
  </ul>
  
  <p>and It should give the results with how many hours the bread has been baking and the capacity that was baked at for that hour so for 130 pieces of bread at capacity 50 the result would be</p>
  
  <pre><code>1-50
  2-50
  3-50
  </code></pre>
  
  <p>I believe the issue is in my while loop but am not exactly sure what the problem is.
  Currently I am not getting the desired output, although the program will compile.</p>
  
  <pre><code>private void btnStart_Click(object sender, RoutedEventArgs e)
  {
      int Bread = 0;
      int Capacity = 0;
      int Time = 0;
      int InitialTime = 0;
      Bread = int.Parse(txtBread.Text);
      Time = int.Parse(txtTime.Text);
      InitialTime = int.Parse(txtInitialTime.Text);
      Capacity = int.Parse(txtCapacity.Text);
  
      while (Bread &gt; 0)
      {
          if (Bread &gt; Capacity)
          {
              Bread -= Capacity;
              txtResult.Text = txtResult.Text + "\n" + (Bread - Capacity).ToString();
              InitialTime += Time;
              txtResult.Text = txtResult.Text + "\n" + (Bread - Capacity ).ToString(); 
          }
  
          else
          {
              Bread -= Capacity;
              txtResult.Text += Bread.ToString(); 
              InitialTime += Time;
          }
  }
  </code></pre>
  
  <p>Thank you everyone :)</p>