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

RichTextBox multithreading

P: n/a
At the moment i am trying to write into a richtextbox using the Rtf
call from another richtextbox.

However realising that richtextbox do not have multithreading - i know
i need to invoke this item and make it multithreaded safe. But i
cannot find a single good example of how to do this. The richtextbox
i am trying to update is on one form - the richtextbox which has the
information to update it with is on another. I understand that i need
to invoke the control which i am updating...but i am just a little
confused.
Can someone give a rough example or point me at a source which makes
this all clear?
Thanks folks!
Liz.

Apr 19 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
You haven't described how you are multithreading. If you have two forms in
your app, by default you don't have more than one thread.

--
Browse http://connect.microsoft.com/VisualStudio/feedback/ and vote.
http://www.peterRitchie.com/blog/
Microsoft MVP, Visual Developer - Visual C#
"lizii" wrote:
At the moment i am trying to write into a richtextbox using the Rtf
call from another richtextbox.

However realising that richtextbox do not have multithreading - i know
i need to invoke this item and make it multithreaded safe. But i
cannot find a single good example of how to do this. The richtextbox
i am trying to update is on one form - the richtextbox which has the
information to update it with is on another. I understand that i need
to invoke the control which i am updating...but i am just a little
confused.
Can someone give a rough example or point me at a source which makes
this all clear?
Thanks folks!
Liz.

Apr 19 '07 #2

P: n/a
Just discovered the reason why this is happening and maybe a better
explanation.
I have a class which creates my own personally designed messagebox and
sets up a few variables.

I have an application which can consist of 2-5 forms - which with
there own closing method which calls said messagebox class on closing
to pop up a box which asks the user to confirm closing.

however - this messagebox has another function - called displaylog -
which is used to display a richtextbox with a list of log messages.

also in that function is a reference to:

thisrichtextbox->Rtf = anotherform->Richtextbox->Rtf;

this then causes a problem - when you close all those forms together -
each form creates its own messagebox - it makes a call to that line.
This then causes threading problems with that line referring to
writing to anotherform's richtextbox.

simplest solution? Sort out my constructor and remove that botch job
- or place a criticalsection around that call or a hybrid of the two.
Apr 23 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.