I'm trying to add multi-thread capabilities to a program I am writing so the users aren't locked into loading a potentially large log file without being able to use the program for anything else. Everything is running smoothly, except that when the new thread finishes, the scrollbar for my DataGridView is horrendously broken. It appears as fragments of other parts of the interface, or not at all, and cannot be clicked on to scroll.
Here's a snippet of the code I'm using to open the new thread up:
Thread workThread = new Thread(LoadLog);
workThread.Start(openFileDialog1.FileName);
The code for LoadLog is extremely large, but what it is doing is parsing log lines into a more readable format, and using DataGridView.Rows.Add(blah, blah, blah) to update the DGV.
I've tried calling Refresh and turning ScrollBars on/off from within the thread, as well as making a delegate for the DGV's Refresh function and calling it at the end. The latter completely locked up my program whenever the number of lines called for the DGV to have a scroll bar.
Does anyone have any idea what the problem is and what I can do to fix it?