Home All Groups Group Topic Archive Search About

Cloning a RichTextBox

Author
9 Jun 2006 12:45 AM
genojoe
I want to transfer a copy of a RichTextBox to a thread but can't seem to find
the right code.  Something like the following seems logical but is not valid
code.  I have tried variations and did Web searches but without success.  Can
someone point me in the right direction?

Dim oRTF As RichTextBox
oRTF = Me.rtfUser.Clone
Me.BackgroundWorker1.RunWorkerAsync(oRTF)

Author
9 Jun 2006 12:58 AM
Mehdi
On Thu, 8 Jun 2006 17:45:02 -0700, genojoe wrote:

> I want to transfer a copy of a RichTextBox to a thread but can't seem to find
> the right code.  Something like the following seems logical but is not valid
> code.  I have tried variations and did Web searches but without success.  Can
> someone point me in the right direction?
>
> Dim oRTF As RichTextBox
> oRTF = Me.rtfUser.Clone
> Me.BackgroundWorker1.RunWorkerAsync(oRTF)

For a start, the richtextbox doesn't implement IClonable and doesn't have a
Clone method. But, anyway, what do you want to do with your richtext box in
this thread? You must not call any control's methods or access any
control's property from a worker thread so i have trouble understanding
what you could do with your cloned richtext box even if cloning a
richtextbox was possible.
Author
9 Jun 2006 1:21 AM
genojoe
Thank you.  I thought that was the answer.  I am just not smart enough to
check on that IClonable stuff. 

I actually want to use the Me.UserRTF.rtf property but when I pass it as a
string to the thread, it sometimes does not work.  Whereas the same code in
the main thread always works.

If I can't find a solution, I will post a better stated description of my
problem. 

Again, thanks for the quick answer.