private void Btn_Annuler_Click(object sender, EventArgs e) { foreach (var Txt_Box in this.Controls.OfType <TextBox>()) { Txt_Box.Clear(); } }
private void Btn_Ajouter_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(Txt_Nom.Text) || string.IsNullOrEmpty(Txt_Code.Text)) { MessageBox.Show("Une ou plusieurs entrées invalides", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { D.PropNom = Txt_Nom.Text; D.PropCode = Txt_Code.Text; Dal_Dept.AddDepartement(D); MessageBox.Show("Ajouté avec succès", "Saved", MessageBoxButtons.OK, MessageBoxIcon.Information); foreach (var Txt_Box in this.Controls.OfType <TextBox>()) { Txt_Box.Clear(); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void Btn_Delete_Click(object sender, RoutedEventArgs e) { this.words.DeleteWord(Txt_Box.Text); this.words.WriteToFile(this.words.Words, this.words.path); Txt_Box.Clear(); ShowWords(); }
private void Btn_Ajouter_Click(object sender, EventArgs e) { try { if (string.IsNullOrEmpty(Txt_Nom.Text) || string.IsNullOrEmpty(Txt_Code.Text)) { MessageBox.Show("Une ou plusieurs entrées invalides", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { S.PropNom = Txt_Nom.Text; S.PropCode = Txt_Code.Text; DateTime Db = dateTimeDeb.Value; S.PropHeureDebut = Db.ToShortTimeString(); MessageBox.Show(S.PropHeureDebut); DateTime Df = dateTimeFin.Value; S.PropHeureFin = Df.ToShortTimeString(); Dal_Sea.AddSeance(S); MessageBox.Show("Ajouté avec succès", "Saved", MessageBoxButtons.OK, MessageBoxIcon.Information); foreach (var Txt_Box in this.Controls.OfType <TextBox>()) { Txt_Box.Clear(); } foreach (var DatePicker in this.Controls.OfType <DateTimePicker>()) { DatePicker.ResetText(); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } }