private void doit() { using (var rf = new ReportForm(rdt, fid, name, sex, address, building, rank, holiday, dat1, dat2, withHoliday, withLeave)) { rf.ShowDialog(); } }
private void btn_Build_Click(object sender, EventArgs e) { if (rdt == null) { MetroFramework.MetroMessageBox.Show(this, "Sorry !\nNo data !", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } try { using (var rf = new ReportForm(rdt, fid, name, sex, address, building, rank, holiday, dat1, dat2, withHoliday, withLeave)) { rf.ShowDialog(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } //using (var wf = new WaitForm(doit, "Building Report...")) //{ // wf.ShowDialog(); //} }