Hi all,
I was wondering if you can help me out with this. I have a dataGridView with a couple of books saved on it. When I click on a book, the book's story loads in a richTextBox. When I change that text and want to save it I want to save the content in a .txt file. How can I go about it?
I have included code for you to see what I want to do.
string FileLine = "";
StreamWriter OutputFile;
foreach (Book book in myBookList)
{
//Book Book = new Book();
Book nBook = myBookList[dgv.CurrentCell.RowIndex];
//PROBLEM IS HERE
OutputFile = new StreamWriter(nBook.TxtFileName);
//-------------------------------------------------------------
//I want it to be something like this: {nBook.TxtFileName}.txt
//-------------------------------------------------------------
//Code to write data to file
OutputFile.WriteLine(FileLine);
OutputFile.Close();
}
Thanks.
J