Click to See Complete Forum and Search --> : Multiline textbox, scrolling to a Line and editing Line


guptan
12-29-2005, 04:23 PM
I've two multiline textboxes side by side in a Windows form. One of them [tb2] display text parsed from other textbox [tb1] (which in turn get populated from file, or user fills it by typing) I can create a TextChanged event for textbox [tb1] and display parsed text in textbox [tb2], as a whole chunk. Few problems I face:


Every time text changes in textbox [tb1] textbox [tb2] scroll bar reset to original top position. How can I programatically scroll Textbox [tb2] to a logically related line number of text that changed in Textbox [tb1]

It is not a good idea to flush whole text from textbox [tb1] to [tb2] everytime something changes in [tb1]. Is there anyway to edit a Line of Textbox?


I hope someone here will be able to help me out.

good day!

--
I'm using C# Express Edition 2005

Kamikazi
07-07-2006, 05:37 AM
Set the cursor position then type...

textBox1.ScrollToCaret();

Will scroll the textbox to the cursor position.