How to save incoming data from serial port to a text file
<p>I have two buttons on my window.</p>

<ol>
<li>By clicking the start button I want to open the port and
see the data in the textbox and at the same time i want to save this data    in    Another empty text file line by line. </li>
<li><p>And by clicking the stop button the program just stops saving    the     data but still shows the incoming data from serial port in the textbox. Can someone help? My code for start and stop button looks like: </p>

<pre><code>private void buttonStart_Click(object sender, EventArgs e)
{

    serialPort1.PortName = pp.get_text();
    string Brate = pp.get_rate();
    serialPort1.BaudRate = Convert.ToInt32(Brate);

      serialPort1.Open();

    if (serialPort1.IsOpen)
    {
        buttonStart.Enabled = false;
        buttonStop.Enabled = true;
        textBox1.ReadOnly = false;
    }
}


private void buttonStop_Click(object sender, EventArgs e)
{


    string Fname = pp.get_filename();
    System.IO.File.WriteAllText(Fname, this.textBox1.Text);


}
</code></pre></li>
</ol>