VB.Net - Text File Reading Previous Lines
Posted on 2015-01-13
Good Day Experts!
I have a new hot project here that I am having trouble finding a way to do one of the required functions.
The text file has orders for a specific CustomerName and an OrderNumber on a line. So, first I search for a specific CustomerName in the file iterating through the lines using a StringReader. I find the CustomerName and grab the OrderNumber from the end of the line. So, I iterate through more lines until I find the next occurrence of the specific CustomerName but the OrderNumber will be different. When this happens, I need to back up one line. That line contains the dollar amount for the OrderNumber.
I am not sure how to back up a line in the StringReader or even if I need to use a different text file manipulation tool that gets previous lines.
Here is a skeleton sample of the data:
Bob's Tree Farm 1234
Bob's Tree Farm 5678
Bob's Tree Farm 9012
Can you lend some insight?