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. caret line number (not the "just" line number )

caret line number (not the "just" line number )

Scheduled Pinned Locked Moved Visual Basic
tutorial
4 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.
  • N Offline
    N Offline
    NANCO
    wrote on last edited by
    #1

    Hi! I would like to; "really" know how to get the current text line number where the caret is at. (not the "line number" just the "text line number": when you use textbox1.lines(0) it takes the entire text in line 0 even if some text are in line 1, because the text in line 1(as long as it didn't get there by pressing the return key) belongs to line 0, but when I use the code below it just says the text in line 1(even thought it belongs to line 0) as belonging to line 1.) a = Rtb.GetLineFromCharIndex(rtb.SelectionStart) So can anyone tell me a way to get the real line number of the selected text. thanks in advance

    D 1 Reply Last reply
    0
    • N NANCO

      Hi! I would like to; "really" know how to get the current text line number where the caret is at. (not the "line number" just the "text line number": when you use textbox1.lines(0) it takes the entire text in line 0 even if some text are in line 1, because the text in line 1(as long as it didn't get there by pressing the return key) belongs to line 0, but when I use the code below it just says the text in line 1(even thought it belongs to line 0) as belonging to line 1.) a = Rtb.GetLineFromCharIndex(rtb.SelectionStart) So can anyone tell me a way to get the real line number of the selected text. thanks in advance

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

      Reposting the same question in the same day won't get it answered any faster. The RTB doesn't support giving you the screen text line of the caret. The screen line of text also doesn't have any meaning. What screen text line is the caret on if the top line of text displayed is only partially visible?? See what I mean? You can get the position of the first character of the line, but there is no method to convert that position to a screen text line. So what are you trying to do with this anyway??

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

      N 1 Reply Last reply
      0
      • D Dave Kreskowiak

        Reposting the same question in the same day won't get it answered any faster. The RTB doesn't support giving you the screen text line of the caret. The screen line of text also doesn't have any meaning. What screen text line is the caret on if the top line of text displayed is only partially visible?? See what I mean? You can get the position of the first character of the line, but there is no method to convert that position to a screen text line. So what are you trying to do with this anyway??

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

        N Offline
        N Offline
        NANCO
        wrote on last edited by
        #3

        never mind I found a way.

        D 1 Reply Last reply
        0
        • N NANCO

          never mind I found a way.

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

          Care to post it?

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

          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