private void btnAgregarMascota_Click(object sender, EventArgs e) { Cliente cli = new Cliente(); if (dgbAgregarCliente.RowCount == 0) { MessageBox.Show("No hay clientes cargados", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { cli = (Cliente)dgbAgregarCliente.CurrentRow.DataBoundItem; if (mascota == null) { mascota = new frmAgregarMascota(cli); mascota.MdiParent = this.MdiParent; mascota.FormClosed += new FormClosedEventHandler(MascotaFormClosed); mascota.Show(); } } }
void MascotaFormClosed(object sender, EventArgs e) { mascota = null; }