private void btnVisualizar_Click(object sender, EventArgs e) { try { vw_emprestimo_aluno locatario = dgvEmprestimo.CurrentRow.DataBoundItem as vw_emprestimo_aluno; frmCadastrar frm = new frmCadastrar(); frm.PreencherCampos(locatario.id_emprestimo); ((frmPrincipal)this.ParentForm).CarregarPanel(frm); } catch (Exception ex) { if (ex.Message.Contains("Referência de objeto não definida para uma instância de um objeto")) { MessageBox.Show("Selecione um emprestimo!", "Biblioteca", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
private void btnCadastrar_Click(object sender, EventArgs e) { frmCadastrar frm = new frmCadastrar(); ((frmPrincipal)this.ParentForm).CarregarPanel(frm); }