Illegal CrossThread Exception thrown when proccess is long
I didn't want to post this in the C# forum because the programs VB, so here it is...
I got a proccess thread thats in charge of loading a listbox full of the first line of text for richtextbox items. Though I use Me.Invoke(New MethodInvoker...) to add items on the main thread so its thread safe it coughs when large amounts of rtf data are thrown at it, acting as if I hadnt called adding the items on the main thread.
Up at the class level:
Dim Worker As System.Threading.Thread
In the load procedure for the form:
Worker = New System.Threading.Thread(AddressOf WorkerDo)
Private Sub WorkerDo()
Me.Invoke(New MethodInvoker(AddressOf FillList)
Private Sub FillList()
For i As Integer = 0 To 'Upper index of collection of richtextbox controls
List listItems is the list. I've tried creating a temporarily listbox in memory and than copy over the items to the desired listbox, but its getting stuck with the same exception even though the listbox has been created within the same subroutine (Filllist that is).
I admit I'm not too knowledgeable about pThreads yet, but I can't have it fill the list at the form's loading procedure because there are no items to put into the list until the task of loading up the RichTextBox array (also part of the pThread) has been finished. So right now I'm stuck at a dead end again...