Click here to Skip to main content
15,880,972 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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 21:57pm

try this
VB
RichTextBox1.Select(1, RichTextBox1.GetFirstCharIndexFromLine(1))' Give your line number
        RichTextBox1.SelectedText = ""
 
Share this answer
 
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
 
Share this answer
 

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