コード例 #1
0
        private void supprimerToolStripMenuItem_Click(object sender, EventArgs e)
        {
            
            int suprCmd;
            if (lvcdes.SelectedIndices.Count != 1)
            {
                MessageBox.Show("Veuillez Selction au moin une commande", "erreur");
            }
            else
            {
                DialogResult dr = MessageBox.Show("Confirmation avant supression", "Suppression", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

                if (dr == DialogResult.Yes)
                {
                    Commande cmd = new Commande();
                    suprCmd = Convert.ToInt32(lvcdes.FocusedItem.Text);
                    try
                    {
                        cmd.supprimerCommande(suprCmd);
                        AfficherListe();
                    }
                    catch (MonException excep)
                    {
                        MessageBox.Show(excep.MessageSysteme(), "Erreur de modification");
                    }
                }
                
            }
        }