private void grdListe_KeyUp(object sender, KeyEventArgs e) { String //recuperation des valeurs des conditions pour la recherche des objets realisers date = DateTime.Today.Date.ToShortDateString(); string op = "%"; if (cmbOperation2.SelectedValue != null) { if (cmbOperation2.SelectedValue.ToString() != "Tout") { op = cmbOperation2.SelectedValue.ToString(); } } if (dpiDateOperation2.SelectedDate != null) { date = dpiDateOperation2.SelectedDate.Value.Date.ToShortDateString(); } motif = txtMotif2.Text; string critere = "dateop = " + "'" + date + "' AND codeop LIKE " + "'" + op + "' AND motif LIKE " + "'%" + motif + "%'"; if (e.Key == Key.Delete) { if (MessageBox.Show("Voulez vous supprimer?", "School : Confirmation", System.Windows.MessageBoxButton.YesNo) == MessageBoxResult.Yes) { if (grdListe.SelectedIndex != -1) { RealiserBE realiser = new RealiserBE(); realiser = realisers.ElementAt(grdListe.SelectedIndex); caisseBL.supprimerRealiser(realiser); realisers.Remove(realiser); grdListe.ItemsSource = realisers; grdListe.Items.Refresh(); } else { MessageBox.Show("Aucune ligne sélectionnée", "School brain:Alerte"); } } } }