Hi All,
I have the code below, which I was using with a CheckedListBox. I've now the need to use a DataGridView instead to display the data. The code was set to find the selected data in the CheckedListBox and then basically delete the line from in.txt so it didn't show the item anymore.
How can I modify this, so when I have selected a row from the DataGridView, it removes the line from the text file?
I have the code below, which I was using with a CheckedListBox. I've now the need to use a DataGridView instead to display the data. The code was set to find the selected data in the CheckedListBox and then basically delete the line from in.txt so it didn't show the item anymore.
Code:
'Write/Read all the in.txt find checked value and replace line with vbNewline and nothing
'Basically deletes the line! Important so it doesn't leave a checkbox with no value
Dim TheFile As String = "c:\in.txt"
File.WriteAllText(TheFile, File.ReadAllText(TheFile).Replace(CheckedListBox1.SelectedItem & vbNewLine, ""))