private void btnLogin_Click(object sender, EventArgs e) { if (!this.CheckLogin(this.textBoxPhone.Text, this.textBoxPass.Text)) { MessageBox.Show(this, "Login failed", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } using (var frm = new frmForm(this.textBoxPhone.Text, this.textBoxPass.Text, this.textBoxNick.Text)) { this.Visible = false; frm.ShowDialog(); this.Visible = true; this.BringToFront(); } }