示例#1
0
 private void btnQuitar_Click(object sender, EventArgs e)
 {
     try
     {
         if (CLO.Count > 0)
         {
             if (MessageBox.Show(this, "Desea eliminar este renglón?", Application.ProductName, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
             {
                 foreach (var item in CLO)
                 {
                     using (var context = new Profit_RGEntities())
                     {
                         var Y = grd_CL.CurrentRow.Cells[3].Value;
                         CLO.RemoveAt(grd_CL.CurrentCell.RowIndex);
                         context.pGIT_Config_LogicaEliminar(Guid.Parse(Y.ToString()));
                         grd_CL.DataSource  = "";
                         grd_CL.DataSource  = CLO;
                         grd_CL.CurrentCell = grd_CL[0, CLO.Count - 1];
                     }
                     CargarDG();
                 }
             }
         }
     }
     catch (Exception ex1)
     {
         MessageBox.Show(this, ex1.Message, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }