public static void init() { loginform LoggForm = new loginform(); //while (Logged != true) //{ if (LoggForm.ShowDialog() == DialogResult.OK) { PW = LoggForm.tbPW.Text; User = ((ComboboxItem)LoggForm.cbUser.SelectedItem).Value.ToString(); Tools.userShowName = ((ComboboxItem)LoggForm.cbUser.SelectedItem).Text.ToString(); Logged = true; LoggForm.Dispose(); } else { Environment.Exit(0); }; }