my function not functioning
-
i want to validate first if the form is already loaded or not. if it is already loaded the form will just prompt it again perform it windows state to normal and focus but does not duplicate the form..
private void newToolStripMenuItem_Click(object sender, EventArgs e) { if (IsFormLoaded("form2")) { return; } Form1 frmshow = new Form1(); frmshow.MdiParent = this; frmshow.Show(); } private bool IsFormLoaded(string formName) { bool Load = false; for (int i = 0; i < (this.OwnedForms.Length) - 1; i++) { if (this.OwnedForms[i].Name.ToString().TrimStart() == "formName") { this.OwnedForms[i].WindowState = FormWindowState.Normal; this.OwnedForms[i].Focus(); Load = true; } } return Load; }
-
i want to validate first if the form is already loaded or not. if it is already loaded the form will just prompt it again perform it windows state to normal and focus but does not duplicate the form..
private void newToolStripMenuItem_Click(object sender, EventArgs e) { if (IsFormLoaded("form2")) { return; } Form1 frmshow = new Form1(); frmshow.MdiParent = this; frmshow.Show(); } private bool IsFormLoaded(string formName) { bool Load = false; for (int i = 0; i < (this.OwnedForms.Length) - 1; i++) { if (this.OwnedForms[i].Name.ToString().TrimStart() == "formName") { this.OwnedForms[i].WindowState = FormWindowState.Normal; this.OwnedForms[i].Focus(); Load = true; } } return Load; }
-
i want to validate first if the form is already loaded or not. if it is already loaded the form will just prompt it again perform it windows state to normal and focus but does not duplicate the form..
private void newToolStripMenuItem_Click(object sender, EventArgs e) { if (IsFormLoaded("form2")) { return; } Form1 frmshow = new Form1(); frmshow.MdiParent = this; frmshow.Show(); } private bool IsFormLoaded(string formName) { bool Load = false; for (int i = 0; i < (this.OwnedForms.Length) - 1; i++) { if (this.OwnedForms[i].Name.ToString().TrimStart() == "formName") { this.OwnedForms[i].WindowState = FormWindowState.Normal; this.OwnedForms[i].Focus(); Load = true; } } return Load; }
Please, don't repost a question so quickly. Your original question is only a couple of questions down, so be patient and post any updates to your question on that one. Don't start a new thread as this is rude.
"WPF has many lovers. It's a veritable porn star!" - Josh Smith
As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.