Hey!
I am trying to implement a log viewer in c#. It has to read from a static text file and make it a bit more readable. Because I am new to windows forms and c#, the listview looked like the easiest way of implementing the functionality I needed (background highlighting, doubleclick on a row). Unfortunately when I moved from my 100 line test text file to a more realistic 20mb text file my program slowed to a crawl (about 1 minute before it showed any text).
here is the code I used to add the listviewItems
logView1.BeginUpdate();
String line;
while((line = fileRead.ReadLine())!= null)
{
ListViewItem lvi = new ListViewItem();
lvi.Text = line;
logView1.Items.Add(lvi);
}
fileRead.Close();
fileNew.Close();
logView1.EndUpdate();
If anyone has any suggestions on how I could speed this up I would greatly appreciate it but I think I will probably have to move onto a different type of container. I have had a look at the dataGridView but that looks like a bit of overkill for parsing a text file. Does anyone have any recommendations?
regards
Jonathan