简体   繁体   中英

copy RichTextBox content and paste to Hotmail, Yahoo like Rich Text Editor

in my vb.net application i want to copy RichTextBox1 's contents and paste to

Hotmail, Yahoo kind of Rich Text Editor.

this is what i did until now but it only copy and paste text only not contains image and format.

RichTextBox1.LoadFile("test.rtf")
' Get the text from your rich text box
Dim textContents As String = RichTextBox1.Rtf
' Copy the text to the clipboard
Clipboard.SetText(textContents, TextDataFormat.Rtf)  
RichTextBox1.Copy() 
WebBrowser1.Document.GetElementById("rtetext").InnerText = Clipboard.GetText(TextDataFormat.Rtf)

first time i thought it not difficult problem but now i feel this is not simple problem.

i referenced and searched much in google but only can copy and paste text .

any help much appreciate

I can't remember the exact details for how to do this, but hopefully this helps.

Firstly, you're using both RichTextBox.Copy and Clipboard.SetText which seems redundant. Secondly, the use of ClipBoard.SetText implies that you're only copying the text, if you want to get all the data I think you need to look at Clipboard.SetDataObject .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM