On Nov 1, 10:05 am, "Jon Skeet [C# MVP]" <sk...@pobox.comwrote:
On Nov 1, 2:53 pm, Soulless <dgmsal...@gmail.comwrote:
Is anyone aware of any issues running a loop inside a thread? I have
a thread running and inside of it I do a foreach on each row of a
datagrid and then i send an event back to the form to insert a row in
a text box. For each row on the datagrid, I add a line to the text
box... textbox += data.
The problem is my thread and the loop seem to have a problem where the
textbox has a good line or two and then every line after it is the
same. If I place a Sleep within the loop (ie. sleep(25)) then it
works fine.
Anyone encounter something weird like this?
That sounds like you're accessing the UI from a worker thread. You
mustn't do this.
Seehttp://pobox.com/~skeet/csharp/threads/winforms.shtml
Jon
Hi, yeah I am utilizing a brThread business rule class that handles
the threading and am using invoke... however, I will check to see if
it is a worker thread which could be the problem.... just seems like
my thread is out of control and debugging doesn't really help me.
Again, adding a sleep in there fixes it, but is not really a
solution. Thanks!