【发布时间】:2013-02-04 08:18:21
【问题描述】:
我有 6 列,其中第一列是文本框单元格,其余的是复选框。 我想把二维数组的值放到数据网格中。
string[,] debugger={{"name","0","0","1","1","0"}};
0=假 1=true(我从 datagridview 属性窗口分配了 false 值和 true 值。 当我尝试这个时,它给了我一个格式异常?
grdFont.ColumnCount=6;
var row = new DataGridViewRow();
row.Cells.Add(new DataGridViewTextBoxCell()
{
Value = debugger[0]
});
row.Cells.Add(new DataGridViewCheckBoxCell()
{
Value = debugger[1]
});
row.Cells.Add(new DataGridViewCheckBoxCell()
{
Value = debugger[2]
});
row.Cells.Add(new DataGridViewCheckBoxCell()
{
Value = debugger[3]
});
row.Cells.Add(new DataGridViewCheckBoxCell()
{
Value = debugger[4]
});
row.Cells.Add(new DataGridViewCheckBoxCell()
{
Value = debugger[5]
});
grdFont.Rows.Add(row);
还有其他方法可以实现吗?
【问题讨论】:
-
为什么要使用调试器[1]、[2] 等?循环执行
-
因为我在进行可行性研究而不是实际应用。
标签: c# datagridview multidimensional-array