删除RichTextBox中的指定行 [英] Delete a specified line in RichTextBox
本文介绍了删除RichTextBox中的指定行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想删除RichTextBox中的指定行而不将其复制到另一个字符串或数组,因为它会删除文本的格式。
我尝试使用
RichTextBox.Lines(specified_line)=
但它不起作用。我该怎么办?
提前致谢!
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!
推荐答案
试试这个
try this
RichTextBox1.Select(1, RichTextBox1.GetFirstCharIndexFromLine(1))' Give your line number
RichTextBox1.SelectedText = ""
>
RichTextBox1.Lines = RichTextBox1.Lines.Take(RichTextBox1.Lines.Count - 1).ToArray
RichTextBox1.Lines = RichTextBox1.Lines.Take(RichTextBox1.Lines.Count - 1).ToArray
这篇关于删除RichTextBox中的指定行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文