Пример #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            if (dataGridView1.CurrentRow != null)
            {
                if (dataGridView1.CurrentRow.Selected == false)
                {
                    this.Alert(" sélectionnez la ligne à mettre à jour", Form_Alert.enmType.Warning);
                }
                else
                {
                    if (dataGridView1.SelectedCells.Count > 0)
                    {
                        int             selectedrowindex = dataGridView1.SelectedCells[0].RowIndex;
                        DataGridViewRow selectedRow      = dataGridView1.Rows[selectedrowindex];
                        string          numerof          = Convert.ToString(selectedRow.Cells[0].Value);
                        DateTime        date             = Convert.ToDateTime(selectedRow.Cells[1].Value.ToString());

                        string   garage      = Convert.ToString(selectedRow.Cells[2].Value);
                        string   Véhicule    = Convert.ToString(selectedRow.Cells[3].Value);
                        string   montant     = Convert.ToString(selectedRow.Cells[4].Value);
                        string   nbon        = Convert.ToString(selectedRow.Cells[5].Value);
                        DateTime datepayment = Convert.ToDateTime(selectedRow.Cells[6].Value.ToString());

                        string KILOMÉTRAGE = Convert.ToString(selectedRow.Cells[7].Value);

                        Editfacture editf = new Editfacture(numerof, date, garage, Véhicule, montant, nbon, datepayment, KILOMÉTRAGE);
                        editf.ShowDialog();
                        dataGridView1.DataSource = null;
                        LoadData();
                        Montant_sum();
                    }
                }
            }
        }
Пример #2
0
        private void dataGridView1_CellDoubleClick_1(object sender, DataGridViewCellEventArgs e)
        {
            if (dataGridView1.SelectedCells.Count > 0)
            {
                int             selectedrowindex = dataGridView1.SelectedCells[0].RowIndex;
                DataGridViewRow selectedRow      = dataGridView1.Rows[selectedrowindex];
                string          numerof          = Convert.ToString(selectedRow.Cells[0].Value);
                DateTime        date             = Convert.ToDateTime(selectedRow.Cells[1].Value.ToString());

                string   garage      = Convert.ToString(selectedRow.Cells[2].Value);
                string   Véhicule    = Convert.ToString(selectedRow.Cells[3].Value);
                string   montant     = Convert.ToString(selectedRow.Cells[4].Value);
                string   nbon        = Convert.ToString(selectedRow.Cells[5].Value);
                DateTime datepayment = Convert.ToDateTime(selectedRow.Cells[6].Value.ToString());

                string KILOMÉTRAGE = Convert.ToString(selectedRow.Cells[7].Value);

                Editfacture editf = new Editfacture(numerof, date, garage, Véhicule, montant, nbon, datepayment, KILOMÉTRAGE);
                editf.ShowDialog();
                dataGridView1.DataSource = null;
                LoadData();
            }
        }