private void BtnLogin_Click(object sender, EventArgs e) { dtoAccount.Username = txtUserName.Text; dtoAccount.Password = txtPassword.Text; if (bllAccount.CanLogin(dtoAccount)) { dtoStaff = bllStaff.GetByUserName(txtUserName.Text); Close(); Thread thread = new Thread( delegate() { Application.Run(new Main(dtoStaff)); }); thread.SetApartmentState(ApartmentState.STA); thread.Start(); } else { labelFail.Visible = true; } }