如何将数据添加到的DataGridView [英] How to add data to DataGridView

查看:114
本文介绍了如何将数据添加到的DataGridView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有像

 X={ID="1", Name="XX",
    ID="2", Name="YY" };



如何转储这个数据到 DataGridView的两列

在GridView就像

The gridView is like

ID |名称

我们可以使用LINQ来做到这一点。我是新来的 DataGridView的 Pleaese帮我做到这一点..

Can we use LINQ to do this. I'm new to DataGridView Pleaese help me to do this..

在此先感谢

推荐答案

首先你需要2列添加到数据网格。你可以在设计时做到这一点。见Columns属性。
,则添加行就像你所需要的。

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆