未将对象引用设置到对象的实例
计算一个字段里每一个不为空值的值出现过几次,用count_ab统计出来,可以设置断点跟踪的时候,当n等于1,也就是第二次遍历时就出现了错误,为什么,求解答,不甚感激!!if (this.dataGridView5.Rows.Cells.Value != null )
{
value_ab = dataGridView5.Rows.Cells.Value.ToString();
for (int n = 0; n < 260; n++)
{
if (value_ab == dataGridView5.Rows.Cells.Value.ToString())
{
count_ab++;
}
}
sup_ab = (double)count_ab / (double)sum;
dataGridView6.Rows.Cells.Value = sup_ab.ToString();
}
file:///C:/Users/Administrator/AppData/Roaming/Tencent/Users/790426053/QQ/WinTemp/RichOle/~7OQ)UO8TNBL5AY7K(TBMLI.jpg
for (int n = 0; n < 260; n++)
//在这加个判断
if (dataGridView5.Rows.Cells.Value.ToString()!="")
对了 以后发帖到求助专区发帖, 不要在这个版块 好的,谢谢提醒
页:
[1]