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. C#
  4. detecting current line in a RichTextBox

detecting current line in a RichTextBox

Scheduled Pinned Locked Moved C#
helpquestion
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.
  • G Offline
    G Offline
    gonad
    wrote on last edited by
    #1

    does anyone know how i can detect the position of the cursor in a richtextbox control? i have a text file that is displayed in the rtb control and i want to determine what the line and character position of the cursor is. ANY help on this is appreciated. thanks. :)

    I 1 Reply Last reply
    0
    • G gonad

      does anyone know how i can detect the position of the cursor in a richtextbox control? i have a text file that is displayed in the rtb control and i want to determine what the line and character position of the cursor is. ANY help on this is appreciated. thanks. :)

      I Offline
      I Offline
      Ista
      wrote on last edited by
      #2

      int myLine = rtf1.GetLineFromCharIndex(rtf1.SelectionStart); I'm not an expert yet, but I play one at work. Yeah and here too.

      G 1 Reply Last reply
      0
      • I Ista

        int myLine = rtf1.GetLineFromCharIndex(rtf1.SelectionStart); I'm not an expert yet, but I play one at work. Yeah and here too.

        G Offline
        G Offline
        gonad
        wrote on last edited by
        #3

        Thanks for your help. This was just enough to get me started. I had no idea there was actually a method for this...i guess i should have looked at msdn first. :) btw, experts are those who never admit it. :) i appreciate your help.

        I 1 Reply Last reply
        0
        • G gonad

          Thanks for your help. This was just enough to get me started. I had no idea there was actually a method for this...i guess i should have looked at msdn first. :) btw, experts are those who never admit it. :) i appreciate your help.

          I Offline
          I Offline
          Ista
          wrote on last edited by
          #4

          not in a job interview if your a consultant.:cool: the easiest way to find the methods, propertiesw, and events is to hit for your object browser. Thas how I found it. nick I'm not an expert yet, but I play one at work. Yeah and here too.

          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