private void addButton_Click(object sender, EventArgs e) { var addName = new AddName(tabControl.SelectedTab == tabEnvironments, _loadedSettings); addName.Closing += NameAdded_EventHandler; addName.Show(); }