private void buttonAccountingMain_Click(object sender, EventArgs e) { if (PublicVariables.GetDefaultSeason == null) { MessageBox.Show("Select a Season first."); return; } // check to see if the form is open if ((Application.OpenForms["FormAccounting"] as FormAccounting) != null) { // if it is then select the right form foreach (Form form in Application.OpenForms) { if (form.Name == "FormAccounting") { // activate it form.Activate(); if (form.WindowState == FormWindowState.Minimized) { form.WindowState = FormWindowState.Normal; } } } } else { // otherwise create a new instance of the form and show it FormAccounting formAccounting = new FormAccounting(); formAccounting.Show(); } }
public void doAfterLogin(string userSkr, string area) { this.area = area; if (statusForm == 1) { FormCEO f = new FormCEO(); f.MdiParent = this; f.FormBorderStyle = FormBorderStyle.None; f.ControlBox = false; f.Show(); f.Location = new Point(0, 0); } if (statusForm == 2) { FormKepCab f = new FormKepCab(); f.MdiParent = this; f.FormBorderStyle = FormBorderStyle.None; f.ControlBox = false; f.update_area(area); f.Show(); f.Location = new Point(0, 0); } else if (statusForm == 3) { FormFinance f = new FormFinance(); f.MdiParent = this; f.FormBorderStyle = FormBorderStyle.None; f.ControlBox = false; f.Show(); f.Location = new Point(0, 0); } if (statusForm == 4) { FormPetty f = new FormPetty(); f.MdiParent = this; f.FormBorderStyle = FormBorderStyle.None; f.ControlBox = false; f.update_area(area); f.Show(); f.Location = new Point(0, 0); } else if (statusForm == 5) { tambahMenuStrip(); } else if (statusForm == 6) { tambahMenuStrip(); } else if (statusForm == 7) { FormAccounting f = new FormAccounting(); f.MdiParent = this; f.FormBorderStyle = FormBorderStyle.None; f.ControlBox = false; f.Show(); f.Location = new Point(0, 0); } else if (statusForm == 8) { FormAEPO f = new FormAEPO(); f.MdiParent = this; f.FormBorderStyle = FormBorderStyle.None; f.ControlBox = false; f.kode = kodeuser; f.status = 1; f.Text = "History Cash Adv"; f.Show(); f.Location = new Point(0, 0); f.updateDGVCashAdv(); f.dataGridViewCA.Invalidate(); } else if (statusForm == 9) { tambahMenuStrip(); } }