我有以下代码,但该列表没有从数据网格中获取确切的值。
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;
}