Adding a newline to textbox in a loop structure
<p>I'm working on my assignment and I've hit a roadblock, been trying to figure out where I'm going wrong in this code. I've searched a fair bit but couldn't find a solution. This is my code.</p>

<pre><code>float Counter = 5.0f;
while (Counter &lt; 24.0f)
{
    string Output = "";
    Output += Counter;
    txtAvgTemp.Text = Output.ToString();
    Counter += 1.5f;
    txtAvgTemp.Text.Split('\n');
}
</code></pre>

<p>my output data just shows 23, it goes through the loop and replaces all the previous string, I would like it too start from 5, print, then add 1.5, print. any help would be appreciated thank you.</p>

<p>Thanks for all the reponses it worked!!
I have to add a calculation as part of the counter.
but its giving me a unhandled error, where im trying to float.parse(volume) not sure why here is the code.</p>

<p>`string AvgTempOutput = "";
        string volume;
        float Counter = 5.0f;
        float heatingCost;</p>

<pre><code>    while (Counter &lt; 24.0f)
    {
        AvgTempOutput += Counter;
        txtAvgTemp.Text += Counter.ToString() + "\r\n";

        volume = txtVolume.Text;
        heatingCost = (25.0f - Counter) * float.Parse(volume);
        txtTableDollars.Text = heatingCost.ToString() + "r\n";

        Counter += 1.5f;


    }`
</code></pre>