I was trying to use streamreader to achieve this but I
don't know how to make it work. I tried several different things but no luck. The text file was made from the same amount of datagridview columns. Overall what I am trying to do is save a selected row and append it to the file from one datagridview on one form then load that saved file into another datagridview on form2 to be displayed as histoy.
Thanks in advance for you help!
I'm new to the form and my code didn't display properly sorry.
Ok here is the code I used to save to the file...
private void button4_Click(object sender, EventArgs e)
{
string location = @"C:\Users\lee\Lees Test File\testfile3.txt";
StreamWriter myWriter = new StreamWriter(location, true);
for (int j = 0; j < dataGridView1.Columns.Count; j++)
{
myWriter.Write(dataGridView1.Rows[selectedRow].Cells[j].Value.ToString() + "|");
}
myWriter.Close();
MessageBox.Show("File Saved!");
}
This is the datagridview that I want to send file to...