Please see this thread that you were posting in. The dictionary also supports a Remove method as in
records.Remove("095")
You could then (using the example in that other thread)
System.IO.File.WriteAllLines(outputfilename, records.Values.ToArray)
which creates an array of strings from the remaining values in the dictionary and writes them to a file.
Reverend Jim
Carpe per diem
3,599 posts since Aug 2010
Reputation Points: 561
Solved Threads: 446
Skill Endorsements: 32
That approach will work as long as you
1) use ReadAllText instead of ReadAllLines
2) include the trailing vbCrLf and replace the line with ""
Otherwise you will be left with a blank line. And to locate the record to delete you'd have to search for
vbCrLf & ID & ","
and do a check for the special case where the record to delete is the first one (with no preceding vbCrLf). All in all, a less robust and less clear approach.
Reverend Jim
Carpe per diem
3,599 posts since Aug 2010
Reputation Points: 561
Solved Threads: 446
Skill Endorsements: 32