using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Data.SQLite; using compabetov2.database; namespace compabetov2 { public partial class login : Form { public login() { InitializeComponent(); txtusuario.TextChanged += Txt_TextChanged; txtcontraseña.TextChanged += Txt_TextChanged; } private void Txt_TextChanged(object sender, EventArgs e) { // Verificar si hay al menos 2 caracteres en ambos TextBox if (txtusuario.Text.Length >= 2 && txtcontraseña.Text.Length >= 2) { button1.Enabled = true; // Habilitar el botón } else { button1.Enabled = false; // Deshabilitar el botón } } private void panel2_Paint(object sender, PaintEventArgs e) { } private void pictureBox1_Click(object sender, EventArgs e) { } private void label3_Click(object sender, EventArgs e) { } private void label4_Click(object sender, EventArgs e) { } private void button1_Click(object sender, EventArgs e) { if (service.iniciarSesion(new database.modelos.Usuario(txtusuario.Text, txtcontraseña.Text))) { MenuPrincipal principal = new MenuPrincipal(service.conseguirInicioSesion(txtusuario.Text)); principal.ShowDialog(); this.Close(); } else { } } private void login_Load(object sender, EventArgs e) { button1.Enabled = false; } private void txtusuario_TextChanged(object sender, EventArgs e) { if (txtusuario.Text.Length >= 2 && txtcontraseña.Text.Length >= 2) { button1.Enabled = true; // Habilitar el botón } else { button1.Enabled = false; // Deshabilitar el botón } } } }