|Inside a textbox i add many lines of data, ended with a newline(\r\n) for each of it.
Each line must be read in a backgroundWorker1_DoWork event. Basically, is a time delay of a couple of seconds between jumping to the other line to be read and processed.
My problem is this: - If i add a new line, WHILE the DoWork is running, the textbox.List.lenght is bigger by 1. What should LOAD that updated List, and pass the next line consecutively, to the worker?
At this point i am blank.
What i did so far...
I inverted the list
why? because my processing is not disturbed by each new line added on top, but is accumulating lines at the end, maintaining the lines numbers and contents when it jumps to the next line.
list1.Clear(); label1.Text = "";
for (int i = 0; i < list1.Count; i++)
label1.Text += list1[i] + nl;
And now the output is:
One solution to updating lines by mistake, and avoid re-processing them, is to completely erase the completed "worked" lines from the List and update somewhere else the finished lines.