private void ascx_LogViewer_Load(object sender, EventArgs e) { if (false == DesignMode) { if (false == loadConfigExecuted) { if (ParentForm != null) { ParentForm.Closing += delegate { DebugMsg.removeRtbObject(rtbDebugMessages); } } ; else { DI.log.error("in ascx_LogViewer_Load, there was not parent so .Closing event could not be set"); } loadConfigExecuted = true; } } }