I'm trying to copy the entire text of a RichTextBox to the clipboard.
This is how I append the text in the RichTextbox:
RichTextBox1.Text += vbNewLine & AlbumName
RichTextBox1.Text += vbNewLine & AlbumLink & vbNewLine
RichTextBox1.SelectionStart = RichTextBox1.Text.Length
RichTextBox1.ScrollToCaret()
But I can't recognize the vbnewline (tried also using VBCrlf):
Private Sub ToolStripMenuItem2_Click(sender As Object, e As EventArgs) Handles ToolStripMenuItem2.Click
Clipboard.SetText(RichTextBox1.Text.Replace(vbNewLine, " "))
End Sub
The notepad can't recognize that blank lines when I paste the text, but if I paste the same copied text into other TextEditor for example in "SublimeText Editor" then the VBNewLines are recognized...
UPDATE
Tried using Environment.NewLine but I get the same result.
This is a example text copied from my richtextbox pasted in the Notepad:
Escape the Fate - Ungrateful (2013)http://vk.com/doc3197020_179614905?hash=97855f387cf7d8a85bThe King Is Dead - Once Upon A Burning House [EP] (2013)http://vk.com/doc3197020_183005958?hash=bdea3f04fe101eae11Sleeping With Sirens - Alone [single] (2013)http://vk.com/doc3197020_182922598?hash=27e50a03a30b4ec89cPalisades - Outcasts (2013)http://vk.com/doc3197020_182588309?hash=90f629956bcfc59029Done!
this is the same text pasted in other editors:
Escape the Fate - Ungrateful (2013)
http://vk.com/doc3197020_179614905?hash=97855f387cf7d8a85b
The King Is Dead - Once Upon A Burning House [EP] (2013)
http://vk.com/doc3197020_183005958?hash=bdea3f04fe101eae11
Sleeping With Sirens - Alone [single] (2013)
http://vk.com/doc3197020_182922598?hash=27e50a03a30b4ec89c
Palisades - Outcasts (2013)
http://vk.com/doc3197020_182588309?hash=90f629956bcfc59029
Done!
You could use:
Private Sub ToolStripMenuItem2_Click(sender As Object, e As EventArgs) Handles ToolStripMenuItem2.Click
Dim curStart As Integer = RichTextBox1.SelectionStart
Dim curLength As Integer = RichTextBox1.SelectionLength
RichTextBox1.SelectAll()
RichTextBox1.Copy()
RichTextBox1.Select(curStart, curLength)
RichTextBox1.Focus()
End Sub