c # The bottom line is this. There are 2 forms in the application, one is the login form, the second where after the login information appears.
login form - loginForm info form - MainForm
With a successful login, the loginFrom closes and the MainForm starts.
//запуск главной формы MainForm mf = new MainForm(); //Закрытие и запуск this.Hide(); mf.ShowDialog(); in MainForm There are buttons to minimize the application to tray
private void hideMenuStrip_Click(object sender, EventArgs e) { if (this.WindowState == FormWindowState.Normal) { //this.WindowState = FormWindowState.Minimized; //если скрываем прогу, то скрываем везде кроме нотифи икон this.Visible = false; this.ShowInTaskbar = false; } } But when you hide the MainForm program, it either closes or the loginForm opens. And I need it to be minimized.
Closes if I add to all the hide buttons below
this.Dispose(); In general, the problem manifests itself in that when the MainForm is minimized, for some reason, the Load function is started in the loginForm