gollem
asked on
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.
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.
ASKER
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
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
ASKER
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
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
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
http://www.csdn.net/Develop/article/12%5C12774.shtm
ASKER
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(DataFor mats.FileD rop, file)
Clipboard.SetDataObject(Da taObject)
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.
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
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(DataFor
Clipboard.SetDataObject(Da
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.
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
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
ASKER
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.
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
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
ASKER
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.
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
see here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rtfbox98/html/vbobjrichedit.asp