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. How to get the no of lines in a richtextbox [modified]

How to get the no of lines in a richtextbox [modified]

Scheduled Pinned Locked Moved Visual Basic
debuggingtutorialquestion
4 Posts 3 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.
  • V Offline
    V Offline
    Vivek Narayanan
    wrote on last edited by
    #1

    I have a for next loop which forms an integral part of my app ,it uses the no of lines in a richtextbox , but whenever i run it on the debugger i get that 1 is greater than RichTextBox.Lines.Length,so is there any other way to get the proper no of lines in the richtextbox????:mad::mad::mad::mad::mad:

    C D 2 Replies Last reply
    0
    • V Vivek Narayanan

      I have a for next loop which forms an integral part of my app ,it uses the no of lines in a richtextbox , but whenever i run it on the debugger i get that 1 is greater than RichTextBox.Lines.Length,so is there any other way to get the proper no of lines in the richtextbox????:mad::mad::mad::mad::mad:

      C Offline
      C Offline
      Ch_Shahzad iqbal
      wrote on last edited by
      #2

      RichTextBox1.Lines.Length

      1 Reply Last reply
      0
      • V Vivek Narayanan

        I have a for next loop which forms an integral part of my app ,it uses the no of lines in a richtextbox , but whenever i run it on the debugger i get that 1 is greater than RichTextBox.Lines.Length,so is there any other way to get the proper no of lines in the richtextbox????:mad::mad::mad::mad::mad:

        D Offline
        D Offline
        Dave Kreskowiak
        wrote on last edited by
        #3

        The only way to do it is RTB.Lines.Length. What "proper" refers to depends on the definition of the word and put forth by the person demanding it. What do you mean when you use "proper" in this context? A line in a RTB can be many screen-lines long. To the RTB, it's a string of text that ends with a CarriageReturn character.

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
             2006, 2007

        V 1 Reply Last reply
        0
        • D Dave Kreskowiak

          The only way to do it is RTB.Lines.Length. What "proper" refers to depends on the definition of the word and put forth by the person demanding it. What do you mean when you use "proper" in this context? A line in a RTB can be many screen-lines long. To the RTB, it's a string of text that ends with a CarriageReturn character.

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
               2006, 2007

          V Offline
          V Offline
          Vivek Narayanan
          wrote on last edited by
          #4

          I found a solution , i changed the code from For index = 0 to RTB.Length to For Each String in RTB.Lines() and it started working,what i meant by proper was,irrespective of the no of lines in the rtb ,rtb.length always returned 0 ,now that i've resolved it i don't think it really matters

          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