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. How do i force richtext box to scroll to a selected text in my code.

How do i force richtext box to scroll to a selected text in my code.

Scheduled Pinned Locked Moved C#
question
3 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.
  • A Offline
    A Offline
    Agyeman
    wrote on last edited by
    #1

    thank you

    Nana

    S 1 Reply Last reply
    0
    • A Agyeman

      thank you

      Nana

      S Offline
      S Offline
      S Senthil Kumar
      wrote on last edited by
      #2

      Did you look at the ScrollToCaret[^] method?

      Regards Senthil [MVP - Visual C#] _____________________________ My Blog | My Articles | WinMacro

      F 1 Reply Last reply
      0
      • S S Senthil Kumar

        Did you look at the ScrollToCaret[^] method?

        Regards Senthil [MVP - Visual C#] _____________________________ My Blog | My Articles | WinMacro

        F Offline
        F Offline
        fracalifa
        wrote on last edited by
        #3

        Hi Senthil, I have the same problem, but the ScrollToCare method you have suggested has no effect (or not what I hoped to do) This code snippet should place the cursor always at the current position but it does not scroll to the end of the lines. private void button1_Click(object sender, System.EventArgs e) { try { this.richTextBox1.Clear(); for(int i=0; i<200; i++) { this.richTextBox1.SelectedText = "Index = " + i.ToString() + "\r\n"; // 1. try // this.richTextBox1.AppendText("Index = " + i.ToString()+ "\r\n"); // 2. try // this.richTextBox1.Text += "Index = " + i.ToString()+ "\r\n"; // 3. try this.richTextBox1.ScrollToCaret(); } } catch{} } What's wrong ? Tnx in advance Regards Frank

        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