Copy-paste a file to a richtextbox?

I want to programmatically copy/add a file(s) to a richtextbox.  The file is not a picture but a word-doc, excel.doc, txt-file,...

Not the name of the file, and not the contents of the file, but as an attachment.  Just as if I right-clicked a file in Windows Explorer, clicked Copy, then pasted it into the richtextbox.
gollemAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

twalgraveCommented:
You need to use the OLE objects the RichTextBox supports for this.  

see here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rtfbox98/html/vbobjrichedit.asp
0
gollemAuthor Commented:
Hello, sorry for my late reply. (no email response)

Could you please give me a little example code.  For example I want to add automatically the file(s) path\test.doc, or/and path\test.xls to the richtextbox.

I 've tried different ways but none worked.

Thank you

0
gollemAuthor Commented:
By the way, I've checked your info about the OLEObjects.

I'v tried it, but I get the contents of the file, I would like to have the file as a shortcut(a file) in the richtextbox.  Just like in Outlook when you insert a file or when you copy in the explorer a file and then copy it into the richtextbox.

Maybe I'm doing something wrong?

Thanks
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

twalgraveCommented:
Natively RichTextBoxes do not support hyperlinks like you are talking about.  You can however, look here:

http://www.csdn.net/Develop/article/12%5C12774.shtm
0
gollemAuthor Commented:
Hello again,

I've checked the link information but I'can't download the project example. (so for the moment not helpful)

I've also tried the richtextbox.oleobjects.add method again.  After using the displaytype I got a nice result but the problem is that I can't add more documents, files.

The last approch I wanted to ask is copying the file to the clipboard and then paste it into a richtextbox.  I 've already found an example on this site but it's for VB.net, here's the code(copy file to clipboard):

Dim DataObject As New DataObject()
Dim file(0) As String
file(0) = "C:\Test.txt"
DataObject.SetData(DataFormats.FileDrop, file)
Clipboard.SetDataObject(DataObject)

Can you look at it please, maybe you can easy translate it because it doesn't work in a normal VB6 project. (The pasting can I do with an API)

By the way if you want more points, let me know.

0
twalgraveCommented:
I don't know why you cannot download from the last link provided.

Personally I don't think you're going to want to go the route you are looking at at the moment.  However, if you do, you will want to check out the following:
http://home.online.no/~rkaste/vb/vbhowto/clipbh.htm

0
gollemAuthor Commented:
I've checked the link, I know how to copy a picture(bmp-file), but I didn't find anything how to copy a none picture file(*.xls,*.doc,...) to the clipboard. Is this even possible? If not, I will have to use another solution.  
0
GPrentice00Commented:
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

 -->Accept twalgrave's comment as Answer

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER

GPrentice00
Cleanup Volunteer
0
gollemAuthor Commented:
Hello,

I understand that this question has to been cleaned up.  Do I have to accept the answer of twalgrave?  My question is still not answered correctly.

I have no problem that you delete my question.
0
PashaModCommented:
Question closed and points refunded

PashaMod
CS Moderator
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.