Example #1
0
 private void dataGridView1_KeyUp(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.F1)
     {
         frmFactureAjouterArticle Ajout = new frmFactureAjouterArticle();
         Ajout.ShowDialog(this);
     }
     if (e.KeyCode == Keys.Delete)
     {
         try
         {
             DataGridViewRow selectedRow = dataGridView1.SelectedRows[0];
             string          q           = (string)selectedRow.Cells["Quantite"].Value;
             string          p           = (string)selectedRow.Cells["Prix"].Value;
             int             Quantite    = int.Parse(q);
             float           Prix        = float.Parse(p);
             Total          -= Quantite * Prix;
             labelTotal.Text = Total.ToString();
             dataGridView1.Rows.Remove(selectedRow);
         }
         catch (Exception)
         {
             MessageBox.Show("Aucunne ligne a supprimer...");
         }
     }
 }
Example #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            frmFactureAjouterArticle Ajout = new frmFactureAjouterArticle();

            Ajout.ShowDialog(this);
        }