dev gridcontrol控件中某列单元格值取值与赋值

           不废话,直接上代码

              for (int i = 0; i < gridView1.RowCount; i++)
                    {
                         decimal qmqty = Convert.ToDecimal(this.gridView1.GetRowCellValue(i,gridView1.Columns["期末数量"]));
                         int kunzs = Convert.ToInt32(this.gridView1.GetRowCellValue(i,gridView1.Columns["捆支数"]));
                        decimal mperz = Convert.ToDecimal(this.gridView1.GetRowCellValue(i, gridView1.Columns["米每支"]));
                        decimal zzl = Convert.ToDecimal(this.gridView1.GetRowCellValue(i, gridView1.Columns["支重量"]));
                        if (ckbh == "01")
                        {
                            int gdjianshu = Convert.ToInt32(qmqty / kunzs / mperz);
                            this.gridView1.SetRowCellValue(i, gridView1.Columns["jianshu"], gdjianshu.ToString());
                        }
                        else
                        {
                            int xcjianshu = Convert.ToInt32(qmqty / kunzs / zzl);
                            this.gridView1.SetRowCellValue(i, gridView1.Columns["jianshu"], xcjianshu.ToString());
                        }
                    }             

你可能感兴趣的:(C#.net,devexpress,GridControl)