0
获得平均时间我有一个DataGridView和我列时间 我需要在此的dataGridView 这是我的代码得到平均的所有时间来平均水平,但它不工作我怎样才能从DataGridView
public void avghold()
{
double[] AVG_HLOD = new double[dataGridView1.Rows.Count];
AVG_HLOD = (from DataGridViewRow row in dataGridView1.Rows
where row.Cells["Avg_Hold"].FormattedValue.ToString()
!= string.Empty
select Convert.ToDouble(row.Cells["Avg_Hold"].FormattedValue)).ToArray();
double Avghold = AVG_HLOD.Average();
label17.Text = AVG_HLOD.Average().ToS
}
and this the image from the column
这个错误显示,当我点击运行 Please click here
感谢所有,
为什么它不起作用?你看到什么错误? – confusedandamused
没有错误,但我没有看到标签或文本框中的平均时间 –
单步执行此功能时 - 是否正确抓取列中的值并成功转换它们?我会从那里开始,按照平均值来更新单元格。 – confusedandamused