Threading problems, not working
Posted on 2004-08-01
I need to read a large file, and find certain words in the file, then list them in a listview.
I can do it, but the problem is that it has to read the whole file before it updates the listview. I need to to update the listview as it reads the file, ie. one addition at a time, while it is also continues to read the file. I added the basic functions that I am using, not the full code, but you should be able to see what I am doing for the code below.
t = new Thread(new ThreadStart(Add_Words));
//Words is a property that gets the search words
//This is in a function that reads the file
while((str = reader.ReadLine()) != null)
if (str.IndexOf(search_word) > 0)
this.Words = s;
//I truncate the string to get only the word
private void Add_Words()
item = new ListViewItem(this.Words);