问题描述
- 将datagridview中的值给一个数列
-
if (comboBox2.Text == Convert .ToString ("ChiXiang_left")) { List<double> m_A_ChiXiangCeLiangZhi_XL_L = new List<double>(); //double[,] m_A_ChiXiangCeLiangZhi_XL_L = new double[N, M]; for (int j = 1; j < dataGridView1.ColumnCount; j++) { for (int i = 0; i < dataGridView1.Rows.Count - 1; i++)//循环dataGridView1的行 {
m_A_ChiXiangCeLiangZhi_XL_L.AddRange(Convert .ToDouble (dataGridView1.Rows[i].Cells[j].Value));//将dataGridView1中的第一列存入s1中
GlobalVariable.m_A_ChiXiangCeLiangZhi_XL_L = m_A_ChiXiangCeLiangZhi_XL_L;
}
}
}
错误 CS1502: 与“System.Collections.Generic.List.AddRange(System.Collections.Generic.IEnumerable)”最匹配的重载方法具有一些无效参数
解决方案
m_A_ChiXiangCeLiangZhi_XL_L.AddRange->
m_A_ChiXiangCeLiangZhi_XL_L.Add
解决方案二:
list.Add()就好了啊,AddRange是增加list的
时间: 2024-10-29 10:08:59