private void seDéconnecterToolStripMenuItem_Click(object sender, EventArgs e) { this.Text = " Suivi de poids -- session :"; Form a = new Form_identification(); a.ShowDialog(this); }
private void Valider_Click(object sender, EventArgs e) { if (!(ChampVide() == false)) { MessageBox.Show("Veuillez saisir toutes les informations demandées"); } else { try { DateTime heure = DateTime.Now; //string format = "yyyy-MM-dd HH:MM:ss"; connexion.Open(); OleDbCommand cmd = new OleDbCommand("INSERT INTO Utilisateur (Nom,Prénom,ID,MDP,Taille,Naissance,Genre) VALUES ('" + textBox2.Text + "','" + textBox1.Text + "','" + textBox_id.Text + "','" + textBox_mdp.Text + "','" + textBox3.Text + "','" + textBox5.Text + "','" + listBox1.SelectedIndex.ToString() + "')", connexion); cmd.ExecuteNonQuery(); cmd.Clone(); DialogResult resultat; resultat = MessageBox.Show("Les informations ont été bien prises en compte", "Avertissement", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); if (resultat == System.Windows.Forms.DialogResult.OK) { connexion.Close(); } this.Hide(); Form c = new Form_identification(); c.ShowDialog(); this.Close(); } catch (Exception ex) { MessageBox.Show("Problème de connexion avec la base de donnée" + ex.ToString()); } } connexion.Close(); }
public Form1() { InitializeComponent(); Form_identification b = new Form_identification(); b.ShowDialog(this); ID = b.Id; MDP = b.Mdp; this.Text = " Suivi de poids -- session : " + ID; }
private void button2_Click(object sender, EventArgs e) { string a = "Vous êtes sur le point de fermer la fenêtre. Voulez-vous continuer ?"; string b = "Avertissement"; DialogResult resultat = MessageBox.Show(a, b, MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (resultat == System.Windows.Forms.DialogResult.Yes) { connexion.Close(); this.Hide(); Form c = new Form_identification(); c.ShowDialog(this); this.Close(); } else { ((FormClosingEventArgs)e).Cancel = true; } }