示例#1
0
        private void txtContrasena_KeyPress(object sender, KeyPressEventArgs e)
        {
            user = txtNombreUsuario.Text;

            /*this.Hide();
             * Menu_Principal Abrir = new Menu_Principal();
             * Abrir.ShowDialog();*/

            if (e.KeyChar == Convert.ToChar(Keys.Enter))
            {
                if (Met_Usuarios.Buscar(txtNombreUsuario.Text, txtContrasena.Text) > 0)
                {
                    this.Hide();
                    Menu Abrir = new Menu();
                    Abrir.ShowDialog();
                }
                else
                {
                    MessageBox.Show("Error en los datos");
                }
                txtNombreUsuario.Clear();
                txtContrasena.Clear();
                txtNombreUsuario.Focus();
            }
        }
示例#2
0
        private void lblAceptar_Click(object sender, EventArgs e)
        {
            user = txtNombreUsuario.Text;

            /*this.Hide();
             * Menu_Principal Abrir = new Menu_Principal();
             * Abrir.ShowDialog();*/

            if (Met_Usuarios.Buscar(txtNombreUsuario.Text, txtContrasena.Text) > 0)
            {
                this.Hide();
                Menu Abrir = new Menu();
                Abrir.ShowDialog();
            }
            else
            {
                MessageBox.Show("Error en los datos");
                txtNombreUsuario.Clear();
                txtContrasena.Clear();
            }
        }