Esempio n. 1
0
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            this.Hide();
            Form f = new Inicio();

            f.Closed += (s, args) => this.Close();
            f.Show();
        }
Esempio n. 2
0
        private void btnEntrar_Click(object sender, EventArgs e)
        {
            con.Open();

            MySqlCommand cmd = con.CreateCommand();

            cmd.CommandType = CommandType.Text;
            cmd.CommandText = "select * from usuarios where Login='******' and Senha='" + txtSenha.Text + "'";
            cmd.ExecuteNonQuery();

            DataTable        dt = new DataTable();
            MySqlDataAdapter da = new MySqlDataAdapter(cmd);

            da.Fill(dt);

            i = Convert.ToInt32(dt.Rows.Count.ToString());


            if (i == 0)
            {
                MessageBox.Show("Usuário ou Senha Incorretos", "Login", MessageBoxButtons.OKCancel, MessageBoxIcon.Error);
            }


            else
            {
                MessageBox.Show("Olá!", "Login", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);

                this.Hide();
                Form f = new Inicio();
                f.Closed += (s, args) => this.Close();
                f.Show();
            }

            con.Close();
        }