Reputation: 8636
I am having a datagridview where the content of that datagridview will be from my sample text file. When i click on load i will have the data from sample.txt and that data in that text file is shown in the datagridview. I will have a checkbox column in my datagridview. If the user checks i will select the row and when user clicks delete button i would like to delete that text from the text file.
Suppose my text is as follows
If i click on the check box of first row and click on delete i would like to delete that text from text file
Upvotes: 0
Views: 2165
Reputation: 9986
How about using the Text OBDC or OLE DB to access the text file contents?
You will have to:
Use simple oledb commands to process the data in file. Or use a data adapter.
string sql = "DELETE FROM yourFile WHERE ID=" + ID;
ExecuteNonQuery(sql);
Upvotes: 0
Reputation: 13434
textfiles - How to delete a line from a text file in C#? - Stack ...
How to delete a line from a text file in C#?
See this link .
And some comments from me Here.
Read the all lines search the text u want and delete that text from list and write it in text file.
Upvotes: 0