private void contactsBtn_Click(object sender, EventArgs e) { if (mainPanel.Controls.ContainsKey("Contacts")) { mainPanel.Controls.Remove(contact); } contact = new Contacts(); mainPanel.Controls.Add(contact); contact.BringToFront(); contact.Visible = true; }