如何将数据添加到 DataGridView [英] How to add data to DataGridView
本文介绍了如何将数据添加到 DataGridView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个类似的结构
X={ID="1", Name="XX",
ID="2", Name="YY" };
如何将此数据转储到两列的DataGridView
How to dump this data to a DataGridView
of two columns
gridView 就像
The gridView is like
ID |姓名
我们可以使用 LINQ 来做到这一点.我是 DataGridView
的新手,请帮助我做到这一点..
Can we use LINQ to do this. I'm new to DataGridView
Pleaese help me to do this..
提前致谢
推荐答案
首先你需要向 datagrid 添加 2 列.你可以在设计时做.请参阅列属性.然后根据需要添加行.
first you need to add 2 columns to datagrid. you may do it at design time. see Columns property. then add rows as much as you need.
this.dataGridView1.Rows.Add("1", "XX");
这篇关于如何将数据添加到 DataGridView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文