I have a window that has a button and the button is just supposed to create a window and then delete it. The variable online is initialized to false.
private void button2_Click(object sender, EventArgs e) { ZeitenZeiger zeiten = new ZeitenZeiger(); if (!online) { zeiten.Show(); zeiten.ShowInTaskbar = false; online = true; } else { zeiten.Close(); online = false; } } Thanks for your help.