Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. RichTextBox Lines(0) Remove does not work

RichTextBox Lines(0) Remove does not work

Scheduled Pinned Locked Moved Visual Basic
csharphelptutorialquestionworkspace
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    ESTAN
    wrote on last edited by
    #1

    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

    L 1 Reply Last reply
    0
    • E ESTAN

      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

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      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


      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups