private void btnAdicionar_Click(object sender, EventArgs e) { frmCongregacaoSetor frm = new frmCongregacaoSetor(new objCongregacaoSetor(null)); frm.MdiParent = Application.OpenForms.OfType <frmPrincipal>().FirstOrDefault(); DesativaMenuPrincipal(); Close(); frm.Show(); }
private void btnEditar_Click(object sender, EventArgs e) { //--- check selected item if (dgvListagem.SelectedRows.Count == 0) { AbrirDialog("Favor selecionar um registro para Editar...", "Selecionar Registro", DialogType.OK, DialogIcon.Information); return; } //--- get Selected item objCongregacaoSetor item = (objCongregacaoSetor)dgvListagem.SelectedRows[0].DataBoundItem; //--- open edit form frmCongregacaoSetor frm = new frmCongregacaoSetor(item); frm.MdiParent = Application.OpenForms.OfType <frmPrincipal>().FirstOrDefault(); DesativaMenuPrincipal(); Close(); frm.Show(); }