private void frmSpreadsheetControl_ParentChanged(object sender, EventArgs e) { if (parent != null) { parent.Merge -= new RibbonMergeEventHandler(parent_Merge); } MdiClient parentClient = Parent as MdiClient; if (parentClient == null) { return; } RibbonForm form = parentClient.FindForm() as RibbonForm; if (form == null) { return; } parent = form.Ribbon; parent.Merge += new RibbonMergeEventHandler(parent_Merge); }