private void bunifuImageButton1_Click(object sender, EventArgs e) { listasEscolares frm = this.FormInstances; if (Cmb_grupo.Text == "Seleccione el grupo") { MessageBox.Show("No se ha seleccionado ningun grado", "◄ AVISO | Sistema de Control Escolar ►", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { frm.grado = Convert.ToString(Cmb_grupo.Text); if (txtruta.Text == "Nombre del archivo") { MessageBox.Show("El campo nombre no puede estar vacio", "◄ AVISO | Sistema de Control Escolar ►", MessageBoxButtons.OK, MessageBoxIcon.Warning); txtruta.BorderColorIdle = Color.Red; } else { // se verifica si el formulario no esta minimizado, en caso de estarlo // se lo cambia a un estado normal if (frm.WindowState == FormWindowState.Minimized) { frm.WindowState = FormWindowState.Normal; } AddOwnedForm(frm); frm.FormBorderStyle = FormBorderStyle.FixedSingle; //frm.TopLevel = false; frm.StartPosition = FormStartPosition.CenterScreen; //frm.Dock = DockStyle.Fill; //this.Controls.Add(frm); this.Tag = frm; frm.BringToFront(); frm.Enabled = true; frm.Visible = true; frm.Show(); Warning[] warnings; string[] streamids; string mimeType; string encoding; string extension; byte[] bytes = frm.reportViewer1.LocalReport.Render( "EXCEL", null, out mimeType, out encoding, out extension, out streamids, out warnings); FileStream fs = new FileStream(@"C:\Users\Dreamer\Documents\BOLETAS\" + txtruta.Text + ".xls", FileMode.Create); fs.Write(bytes, 0, bytes.Length); fs.Close(); //frm.Close(); MessageBox.Show("Lista creada y guarda con exito", " AVISO | CONTROL ESCOLAR ►", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
void form_Disposede(object sender, EventArgs e) { modify = null; }
private void tx_listas_TextChanged(object sender, EventArgs e) { if (tx_listas.Text == "1°A") { listasEscolares frm = this.FormInstances; frm.grado = Convert.ToString(tx_listas.Text); if (frm.WindowState == FormWindowState.Minimized) { frm.WindowState = FormWindowState.Normal; } AddOwnedForm(frm); frm.FormBorderStyle = FormBorderStyle.FixedSingle; //frm.TopLevel = false; frm.StartPosition = FormStartPosition.CenterScreen; //frm.Dock = DockStyle.Fill; //this.Controls.Add(frm); this.Tag = frm; frm.BringToFront(); frm.Enabled = true; frm.Visible = true; frm.Show(); } if (tx_listas.Text == "2°A") { listasEscolares frm = this.FormInstances; frm.grado = Convert.ToString(tx_listas.Text); if (frm.WindowState == FormWindowState.Minimized) { frm.WindowState = FormWindowState.Normal; } AddOwnedForm(frm); frm.FormBorderStyle = FormBorderStyle.FixedSingle; //frm.TopLevel = false; frm.StartPosition = FormStartPosition.CenterScreen; //frm.Dock = DockStyle.Fill; //this.Controls.Add(frm); this.Tag = frm; frm.BringToFront(); frm.Enabled = true; frm.Visible = true; frm.Show(); //listasEscolares nom = new listasEscolares(); //nom.Show(); } if (tx_listas.Text == "3°A") { listas3A frm = this.Forminstanc; frm.grado = Convert.ToString(tx_listas.Text); if (frm.WindowState == FormWindowState.Minimized) { frm.WindowState = FormWindowState.Normal; } AddOwnedForm(frm); frm.FormBorderStyle = FormBorderStyle.FixedSingle; //frm.TopLevel = false; frm.StartPosition = FormStartPosition.CenterScreen; //frm.Dock = DockStyle.Fill; //this.Controls.Add(frm); this.Tag = frm; frm.BringToFront(); frm.Enabled = true; frm.Visible = true; frm.Show(); } if (tx_listas.Text == "4°A") { listas4_6 frm = this.Forminstan; frm.grado = Convert.ToString(tx_listas.Text); if (frm.WindowState == FormWindowState.Minimized) { frm.WindowState = FormWindowState.Normal; } AddOwnedForm(frm); frm.FormBorderStyle = FormBorderStyle.FixedSingle; //frm.TopLevel = false; frm.StartPosition = FormStartPosition.CenterScreen; //frm.Dock = DockStyle.Fill; //this.Controls.Add(frm); this.Tag = frm; frm.BringToFront(); frm.Enabled = true; frm.Visible = true; frm.Show(); } if (tx_listas.Text == "5°A") { listas4_6 frm = this.Forminstan; frm.grado = Convert.ToString(tx_listas.Text); if (frm.WindowState == FormWindowState.Minimized) { frm.WindowState = FormWindowState.Normal; } AddOwnedForm(frm); frm.FormBorderStyle = FormBorderStyle.FixedSingle; //frm.TopLevel = false; frm.StartPosition = FormStartPosition.CenterScreen; //frm.Dock = DockStyle.Fill; //this.Controls.Add(frm); this.Tag = frm; frm.BringToFront(); frm.Enabled = true; frm.Visible = true; frm.Show(); } if (tx_listas.Text == "6°A") { listas4_6 frm = this.Forminstan; frm.grado = Convert.ToString(tx_listas.Text); if (frm.WindowState == FormWindowState.Minimized) { frm.WindowState = FormWindowState.Normal; } AddOwnedForm(frm); frm.FormBorderStyle = FormBorderStyle.FixedSingle; //frm.TopLevel = false; frm.StartPosition = FormStartPosition.CenterScreen; //frm.Dock = DockStyle.Fill; //this.Controls.Add(frm); this.Tag = frm; frm.BringToFront(); frm.Enabled = true; frm.Visible = true; frm.Show(); } }