private void pictureBox1_Click(object sender, EventArgs e) { try { //conectar a la bd u = textBox1.Text; p = textBox2.Text; cx = new Connections(this); if (cx.Login(u, p) == "1") { Gerente g1 = new Gerente(nombre, idsucursal, idempleado, idalmacen, nombrefar); g1.Show(this); textBox1.Clear(); textBox2.Clear(); textBox1.Focus(); this.Hide(); } else if (cx.Login(u, p) == "2") { Vendedor v = new Vendedor(nombre, idsucursal, idempleado, idalmacen, nombrefar); v.Show(this); textBox1.Clear(); textBox2.Clear(); textBox1.Focus();//vuelta el foco this.Hide(); } else { MessageBox.Show(cx.Login(u, p)); textBox1.Clear(); textBox2.Clear(); textBox1.Focus(); } } catch { MessageBox.Show("Error de validacion!"); } }