private void button7_Click_1(object sender, EventArgs e) { #region Ajout try { //int n_dirige = textBox1.Text; string code_dirige = textBox2.Text; DateTime date_deb = dateTimePicker3.Value; DateTime date_fin = dateTimePicker4.Value; int direct = int.Parse(comboBox5.SelectedItem.ToString()); int direction = int.Parse(comboBox6.SelectedItem.ToString()); Diriger d = new Diriger(code_dirige, date_deb, date_fin, direct, direction); d.Ajouter(); MessageBox.Show("Opération effectué", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show("Erreur : " + ex.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); } #endregion }