problem occurs while filing
it is saving data amazingly and on retrieving the records on DataGridView
here is the code i am trying but it is also showing the Last Value
of column and 1st value
of next column like this is the info in file and data from file is like: Почему одни и те же данные всегда ??
3519,laiba,99
3519,maheen,89
вот мой код:
private void btnsave_Click(object sender, EventArgs e)
{
FileStream f = new FileStream("D://abc.txt", FileMode.Append, FileAccess.Write);
StreamWriter sw = new StreamWriter(f);
sw.Write(txtregno.Text+","+txtname.Text+","+txtmarks.Text+";");
MessageBox.Show("Saved Successfully");
sw.Close();
}
private void btnshow_Click(object sender, EventArgs e)
{
FileStream f = new FileStream("D://abc.txt", FileMode.Open, FileAccess.Read);
StreamReader sr = new StreamReader(f);
string data = sr.ReadToEnd();
string[] lineWiseRecord = data.Split(';');
foreach (string item in lineWiseRecord)
{
string[] colWiseRecord = item.Split(',');
dataGridView1.Rows.Add(colWiseRecord[0], colWiseRecord[1], colWiseRecord[2] );
}
f.Close();
sr.Close();
}