DataGridView自定义列怎么绑定数据
1个回答
展开全部
for (int i = 0; i < list.Count; i++)
{
dataGridView1.Rows.Add(); //先增加一行
dataGridView1.Rows[i].Cells["colCode"].Value = list[i].Code; //然后给单元格赋值
dataGridView1.Rows[i].Cells["colCategory"].Value = list[i].Category;
dataGridView1.Rows[i].Cells["colSupport"].Value = list[i].Support;
dataGridView1.Rows[i].Cells["colBrand"].Value = list[i].Brand;
dataGridView1.Rows[i].Cells["colName"].Value = list[i].Name;
}
我这里用的是list绑定到datagridview
{
dataGridView1.Rows.Add(); //先增加一行
dataGridView1.Rows[i].Cells["colCode"].Value = list[i].Code; //然后给单元格赋值
dataGridView1.Rows[i].Cells["colCategory"].Value = list[i].Category;
dataGridView1.Rows[i].Cells["colSupport"].Value = list[i].Support;
dataGridView1.Rows[i].Cells["colBrand"].Value = list[i].Brand;
dataGridView1.Rows[i].Cells["colName"].Value = list[i].Name;
}
我这里用的是list绑定到datagridview
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询