Cześć tworze prostą aplikacje i chciałbym zapisać dane z formularza do pliku ale z ostatniego pola nie chce mi sie zapisać bardzo prosze o pomoc. Oto kod
public Form1()
{
InitializeComponent();
}
private void Label4_Click(object sender, EventArgs e)
{
}
private void B2_Click(object sender, EventArgs e)
{
textBox1.Text = "";
textBox2.Text = "";
textBox3.Text = "";
}
private void B1_Click(object sender, EventArgs e)
{
string path = "text.txt";
FileStream fsi = new FileStream(path, FileMode.Append);
byte[] data = Encoding.UTF8.GetBytes(textBox1.Text + "\n");
byte[] data1 = Encoding.UTF8.GetBytes(textBox2.Text + "\n");
byte[] data2 = Encoding.UTF8.GetBytes(textBox3.Text + "\n");
int i = 0;
fsi.Write(data, i,data.Length);
fsi.Write(data1, i++,data1.Length);
//fsi.Write(data2, i++, data2.Length);
fsi.Close();
}