private void btnEntrar_Click(object sender, EventArgs e) { Usuario user = new Usuario(); DaoUsuario dao = new DaoUsuario(); user.Login = txtUsuario.Text; user.Senha = txtSenha.Text; dao.login(user); int resultado; resultado = user.QtdUsuario; if (resultado == 1) { FrmTelaInicio frmTelaInicio = new FrmTelaInicio(); this.Hide(); frmTelaInicio.ShowDialog(); } else { MessageBox.Show("Login Inválido"); } txtUsuario.Clear(); txtSenha.Clear(); }
private void btnDesistir_Click(object sender, EventArgs e) { // Display a message box asking users if they // want to exit the application. if (MessageBox.Show("Deseja realmente desistir?", "Eureka Quiz", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { try { //Esconda o formulario atual this.Hide(); // Crie apenas o segundo form FrmTelaInicio frmTelaInicio = new FrmTelaInicio(); //Mostre o segundo form frmTelaInicio.ShowDialog(); } finally { // ao fechar, mostre novamente o inicial, ou feche this.Close(); this.Show(); } } }
private void btnCancelar_Click(object sender, EventArgs e) { try { //Esconda o formulario atual this.Hide(); // Crie apenas o segundo form FrmTelaInicio frmTelaInicio = new FrmTelaInicio(); //Mostre o segundo form frmTelaInicio.ShowDialog(); } finally { // ao fechar, mostre novamente o inicial, ou feche this.Close(); this.Show(); } }