private void CloseProfile_Click(object sender, EventArgs e) {//close profile and destroy the objects.... dashboardpanelcupanel.Hide(); dataGridView2.Hide(); amountpaymentcu.Hide(); SearchPanel.Visible = true; SearchPanel.BringToFront(); if (OrderWindow != null) { OrderWindow.Dispose(); OrderWindow = null; } }
private void PlaceCustomerOrder_Click(object sender, EventArgs e) { bool check = false; foreach (Form open in Application.OpenForms) { if (open.Name == "Order") { check = true; } } if (!check) { OrderWindow = new PlaceOrder.Order(p1.GetCustomer); OrderWindow.Width = this.Width; OrderWindow.TopLevel = false; CustomerContainer.Controls.Add(OrderWindow); OrderWindow.Dock = DockStyle.Fill; OrderWindow.Show(); OrderWindow.BringToFront(); if (this.IsMdiChild == true) { this.MdiParent.WindowState = FormWindowState.Maximized; } else { this.WindowState = FormWindowState.Maximized; } } else { if (this.IsMdiChild == true) { this.MdiParent.WindowState = FormWindowState.Maximized; } else { this.WindowState = FormWindowState.Maximized; } OrderWindow.BringToFront(); OrderWindow.Show(); } }