private void FormClose(ButtonControl button, CloseReason reason) { DialogPage dialog = button.Report.Pages[CurrentForm] as DialogPage; dialog.Form.DialogResult = button.DialogResult; FormClosingEventArgs closingArgs = new FormClosingEventArgs(reason, false); dialog.OnFormClosing(closingArgs); FormClosedEventArgs closedArgs = new FormClosedEventArgs(reason); dialog.OnFormClosed(closedArgs); dialog.ActiveInWeb = false; }