Search code examples
vb.netrtf

Replace a comma with new line in RTF


I have a Richtextbox that contains text.

For example, it contains Example1,Example2,Example3.

I'm wanting it to replace the commas with a newlines, so it should look like this:

Example1
Example2
Example3

but I don't know how to do this.

I've googled and searched around for this but nothing seems to work.


Solution

  • You can use Replace(oldStr, newStr) like this:

    myRichTextBox.Text = myRichTextBox.Text.Replace(",", vbNewLine)
    

    Have fun.