|    
|
|  |
From: dtolton (Doug) Subject: RichText Box how to control the focus Date: Fri, 07 Jun 2002 19:12:55 GMT
| |
I am writing the contents of StringBuilder object to a RichTextBox. Basically I have a TextWriterTraceListener writing to a StringWriter which writes to an underlying String Builder. // Snippet m_sbTrace = new StringBuilder(); StringWriter sw = new StringWriter(m_sbTrace); TextWriterTraceListener tw = new TextWriterTraceListener(sw); Trace.Listeners.Add(tw); I have another form that references the string builder object and loops, updating the RichTextBox in a background thread: // Snippet while (frmMain.AppStatus == MainForm.RxApplicationStatus.RUNNING) { Thread.Sleep(2000); rtfHistory.Text = sb.ToString(); } The problem that I'm encountering is everytime the loop updates it resets the ViewPort for the RichTextBox. Is there a way to manually position the ViewPort for the box? Say for instance someone was looking at some text somewhere in the middle of the output, can I reposition the ViewPort to that point? Or to the very end of the output? If there is a better way to write the trace output in a friendly viewable fashion I'mto that as well. Doug
| | Post a follow up to this message... |
|  |
|