private void BtnAgregarArticulo_Click(object sender, EventArgs e) { foreach (Form formulario in this.formsAbiertos) { if (formulario is FrmNuevoArticulo castForm) { castForm.WindowState = FormWindowState.Normal; castForm.Show(); castForm.Activate(); return; } } FrmNuevoArticulo form = new FrmNuevoArticulo { StartPosition = FormStartPosition.CenterScreen, Name = "FrmNuevoArticulo" }; form.FormClosed += Frm_FormClosed; form.Show(); Form frm = (Form)form; this.formsAbiertos.Add(frm); }
private void Frm_articuloProfile_edit(object sender, EventArgs e) { Articulo articulo = (Articulo)sender; foreach (Form formulario in this.formsAbiertos) { if (formulario is FrmNuevoArticulo castForm) { castForm.WindowState = FormWindowState.Normal; castForm.IsEditar = true; castForm.Text = "Editar los datos de un artículo"; castForm.Name = "FrmNuevoArticulo"; castForm.Show(); castForm.AsignarDatosArticulo(articulo); castForm.Activate(); return; } } FrmNuevoArticulo form = new FrmNuevoArticulo { StartPosition = FormStartPosition.CenterScreen, IsEditar = true, Text = "Editar los datos de un artículo", Name = "FrmNuevoArticulo" }; form.AsignarDatosArticulo(articulo); form.FormClosed += Frm_FormClosed; Form frm = (Form)form; this.formsAbiertos.Add(frm); }