By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,084 Members | 1,255 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,084 IT Pros & Developers. It's quick & easy.

GUI Delegates & Text Disappearing

P: n/a
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

Apr 7 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Do you have anymore information about the call stack? I ask because you
should have seen something more about where the exception was thrown.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Curious" <th****@mail.global.net.mt> wrote in message
news:11**********************@i39g2000cwa.googlegr oups.com...
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

Apr 7 '06 #2

P: n/a
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.

Apr 8 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.