求教为 GridView 赋值

Trust-Me Trust-Me 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区


为GridView 赋值:

GridView 都用BoundField 默认建的。

this.GVTheGet.Rows[0].Cells[0].Text = gl.rkdh;
this.GVTheGet.Rows[0].Cells[2].Text = gl.th;
this.GVTheGet.Rows[0].Cells[4].Text = gl.xfdw_dm;
this.GVTheGet.Rows[0].Cells[5].Text = gl.dw_dm;
this.GVTheGet.Rows[0].Cells[6].Text = gl.bz;
this.GVTheGet.Rows[0].Cells[7].Text = gl.sl.ToString();

会报超索引错误。

刚从winfrom转NET,习惯DataGridView 中这样赋值,然后报超索引的错的话,加一个
DataGridView.Rows.Add();
就可以了,但是GridView 貌似没有这个方法,求教怎么赋值啊?
.
...全文
评论 13
收藏 已收藏
分享
返回顶部
Trust-Me
.NET社区 62,271 成员 668,968 内容