RichTextBox Lines(0) Remove does not work
-
I have a timer thread that calls a function with the following code: Dim i As Integer = CType(RichTextBox1.Lines.Length / 2, Integer) While i > 0 If RichTextBox1.InvokeRequired() Then ' Invoke the delegate. Me.Invoke(m_RemoveLinesRichTextBoxDelegate) Else RichTextBox1.Lines(0).Remove(0, RichTextBox1.Lines(0).Length) End If i -= 1 End While I like to remove sort of 50% of the lines in the RichTextBox The delegate does contain the same line as if the invoke is not required, the delegate is setup fine. The problem. Well it does not seems to remove the line. Anyone can explain me how to do it correct? I am working with .NET 1.1 Thanks
-
I have a timer thread that calls a function with the following code: Dim i As Integer = CType(RichTextBox1.Lines.Length / 2, Integer) While i > 0 If RichTextBox1.InvokeRequired() Then ' Invoke the delegate. Me.Invoke(m_RemoveLinesRichTextBoxDelegate) Else RichTextBox1.Lines(0).Remove(0, RichTextBox1.Lines(0).Length) End If i -= 1 End While I like to remove sort of 50% of the lines in the RichTextBox The delegate does contain the same line as if the invoke is not required, the delegate is setup fine. The problem. Well it does not seems to remove the line. Anyone can explain me how to do it correct? I am working with .NET 1.1 Thanks
strings are immutable, so string.Remove() returns a new string, it does not modify an existing string. Why not
RichTextBox1.Lines(0)=""
? :)Luc Pattyn [Forum Guidelines] [My Articles]
this months tips: - before you ask a question here, search CodeProject, then Google - the quality and detail of your question reflects on the effectiveness of the help you are likely to get - use PRE tags to preserve formatting when showing multi-line code snippets