Example #1
0
 public static void CalculerSoldeStocksDeFaconProgressive(ADGV.AdvancedDataGridView grid, float stockInitial)
 {
     for (int i = grid.Rows.Count - 1; i >= 0; i--)
     {
         if (i < grid.Rows.Count - 1)
         {
             grid.Rows[i].Cells[4].Value = Convert.ToSingle(grid.Rows[i + 1].Cells[4].Value)
                                           + Convert.ToSingle(grid.Rows[i].Cells[2].Value)
                                           - Convert.ToSingle(grid.Rows[i].Cells[3].Value);
         }
         else
         {
             grid.Rows[i].Cells[4].Value = stockInitial + Convert.ToSingle(grid.Rows[i].Cells[2].Value)
                                           - Convert.ToSingle(grid.Rows[i].Cells[3].Value);
         }
     }
 }
Example #2
0
 public static void Init(ADGV.AdvancedDataGridView adgv)
 {
     gridview    = adgv;
     initialised = true;
 }
Example #3
0
        public static void LocateAdvGridRecord(string searchString, string searchField, int colIndex, ADGV.AdvancedDataGridView dgv)
        {
            //Added on 30.09.2016 in version 2.0.15.1
            //Modified on 10.10.2016 in version 2.0.15.1
            //  Locate first visible column if colIndex<0

            String searchValue = searchString;
            int    rowIndex    = -1;

            int ind = 0;

            if (colIndex < 0)
            {
                //Locate first visible column
                int colInd = 0;

                for (int i = 0; i < dgv.Columns.Count; i++)
                {
                    if (dgv.Columns[i].Visible)
                    {
                        colInd = i;
                        break;
                    }
                }

                ind = colInd;
            }
            else
            {
                ind = colIndex;
            }

            if (!dgv.Columns.Contains(searchField))
            {
                return;
            }

            foreach (DataGridViewRow dgRow in dgv.Rows)
            {
                if (dgRow.Cells[searchField].Value.ToString().Equals(searchValue))
                {
                    rowIndex = dgRow.Index;
                    break;
                }
            }

            if (rowIndex >= 0)
            {
                try
                {
                    dgv.CurrentCell = dgv[ind, rowIndex];
                }
                catch
                {
                }
            }
        }