GUI Delegates & Text Disappearing

C

Curious

Hi,

I have program, creating multiple threads, and each thread is updating
the same richtextbox(appending to previous text), and text in the
statusbar.
To update the richtextbox and statusbar, I am using delegates.

At some point in time the text in the richtextbox is being cleared off.

Also, at some point and infrequently, the following error is being
given:
"An unhandled exception of type 'System.InvalidOperationException'
occurred in mscorlib.dll
Additional information: Unable to set the panel text."
Below is the method where the error just given is being given.

string text = "MyText....."
AddTextDelegate atd = new AddTextDelegate(AddText_rtbActions);
IAsyncResult iar = atd.BeginInvoke(text, null, null);
atd.EndInvoke(iar);

UpdateCounterDelegate ucd = new
UpdateCounterDelegate(DecrementEventsExecuted);
iar = ucd.BeginInvoke(null, null);
ucd.EndInvoke(iar);


Can someone help me out
Thanks in Advance
 
N

Nicholas Paldino [.NET/C# MVP]

Do you have anymore information about the call stack? I ask because you
should have seen something more about where the exception was thrown.
 
C

Curious

Hi,
I added the lock statement where I was appending text to the rtb and in
my status bar panels, and problem seems to be solved.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top