MainForm foreach (Form frm in this.MdiChildren) { if (frm is frm_MF_Sales) { frm.Activate(); ((frm_MF_Sales)this.MdiParent).RefreshSalesGrid(); }
You are going through Form1's MDIChildren (so the forms opened by "this" which if I read this correctly is the MDIContainer), and then you are trying to cast the this.MDIParent (which if you are on the MDIContainer form, would be null) into your sales form
foreach (Form frm in this.MdiChildren) { if (frm is frm_MF_Sales) { frm.Activate(); ((frm_MF_Sales)frm).RefreshSalesGrid(); }