Click here to Skip to main content
14,699,605 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I want to delete a specified line in RichTextBox without copying it to another string or array because it removes the formatting of text.

I tried using

RichTextBox.Lines(specified_line) = ""

But it is not working. What should I do?

Thanks in advance!
Posted
Updated 24-Oct-20 22:57pm

try this
RichTextBox1.Select(1, RichTextBox1.GetFirstCharIndexFromLine(1))' Give your line number
        RichTextBox1.SelectedText = ""
   
Comments
Member 11894297 7-Aug-15 23:06pm
   
RichTextBox1.Select(0, RichTextBox1.GetFirstCharIndexFromLine(1)) RichTextBox1.SelectedText = ""

Prueba esto tambien que elimina la primera linea de

hello delete this line next
hi delete
welcome
RichTextBox1.Lines = RichTextBox1.Lines.Take(RichTextBox1.Lines.Count - 1).ToArray
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900