Cloning a RichTextBox

G

Guest

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)
 
M

Mehdi

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.
 
G

Guest

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.
 

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