示例#1
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            int indice = dtgVentas.CurrentRow.Index;
            int id     = int.Parse(dtgVentas.Rows[indice].Cells[0].Value.ToString());

            pd.Delete(id);
            vd.Delete(id);
            for (int i = 0; i < listav.Count(); i++)
            {
                if (listav.ElementAt(i).Id_Venta == id)
                {
                    listav.RemoveAt(i);
                    break;
                }
            }
            dtgVentas.DataSource = null;
            dtgVentas.DataSource = vd.GetAll();
        }