Hi all,
What I'm trying to do is select data from CheckedListBox1.SelectedItem and then search C:\in.txt for that line and delete it entirely.
I've tried the replace command, but isn't doing want I need as it doesn't remove the entire line as it doesn't remove the carriage return. So when I look back at the CheckedListBox1 it still shows a check box (albeit no data is there). Is there an easy way to do what I want or can I modify the code I'm using below to remove the carriage return somehow?
What I'm trying to do is select data from CheckedListBox1.SelectedItem and then search C:\in.txt for that line and delete it entirely.
I've tried the replace command, but isn't doing want I need as it doesn't remove the entire line as it doesn't remove the carriage return. So when I look back at the CheckedListBox1 it still shows a check box (albeit no data is there). Is there an easy way to do what I want or can I modify the code I'm using below to remove the carriage return somehow?
Code:
Dim TheFile As String = "c:\in.txt"
File.WriteAllText(TheFile, File.ReadAllText(TheFile).Replace(CheckedListBox1.SelectedItem, ""))