private void saveToolStripButton_Click(object sender, EventArgs e) { if (ActiveMdiChild is Coupons) { Coupons coupon = ActiveMdiChild as Coupons; coupon.CreateXMLFile(); } else { MessageBox.Show("Please select a coupon to generate xml file"); } }