0
我有以下代碼,但列表不是從datagrid中獲取確切的值。我們如何以編程方式將數據從數據網格添加到列表中?
public List<double[]> ExtractGridData(DataGridView grid)
{
int numCols = grid.Columns.Count;
List<double[]> list = new List<double[]>();
double[] cellsData = new double[numCols];
foreach (DataGridViewCell cell in grid.SelectedCells)
{
if (cell.Value != null)
cellsData[cell.RowIndex] = Convert.ToDouble(cell.Value);
list.Add(cellsData);
}
return list;
}
你想以檢索選定的單元格/行整個網格數據或數據 – 2013-05-05 04:19:25