How do i force richtext box to scroll to a selected text in my code.
-
Did you look at the ScrollToCaret[^] method?
Regards Senthil [MVP - Visual C#] _____________________________ My Blog | My Articles | WinMacro
-
Did you look at the ScrollToCaret[^] method?
Regards Senthil [MVP - Visual C#] _____________________________ My Blog | My Articles | WinMacro
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