I am getting an unhandled system exception while writing to a RichTextBox. The process may run for a few hours or days before the error is generated
The message is "Cannot access a disposed object named RICHTEXTBOX." A check of the stack trace indicates the error is from the DLL that controls writing to the RTB. The form has not been closed and the line of code referenced is in a catch block that writes any error to this form's RTB (named rtbProgress)
The same code using a TextBox does not produce the error, but I lose the bold formatting options for presenting the data
I am just wodering if the RichTextBox is not the most stable of controls to use in a Windows form application
Ke
Sample code
public void ProgressEntry(String sNewEntry
tr
int iSize = this.rtbProgress.Text.Length; // limit size of string to allowed progress box siz
StringBuilder sb = new StringBuilder(iSize)
sb.Append(@"{\rtf1\ansi ")
sb.Append(@sNewEntry + @" \par ")
sb.Append(this.rtbProgress.Rtf + @"\b0 }")
this.rtbProgress.Rtf = @sb.ToString()
catch (Exception e
rtbProgress.Rtf = e.Message + @"\par "; /// Line reporting erro
}