It's difficult to tell from that code fragment, but if
rtxt_message.AppendText("hellO");
causes an event to be fired then there are two thing you need to check:
1) Is rtxt_message set to an instance of your class?
2) In AppendText, do you check for an event handler before triggering it?
My default format for an event trigger is:
public event EventHandler Changed;
protected virtual void OnChanged(EventArgs e)
{
EventHandler eh = Changed;
if (eh != null)
{
eh(this, e);
}
}
If you do not check for an handler before trying to trigger the event, you will get a null reference exception.
If this doesn't help, then you are going to have to either give us better information, or use a breakpoint and single step into each line until you find the null value.