private void coreButton1_Click(object sender, EventArgs e) { using (TestGridControl Ce = new TestGridControl()) { Ce.ShowDialog(); if (Ce.DialogResult == DialogResult.OK || Ce.DialogResult == DialogResult.Cancel) { } } }