将行添加到绑定的数据视图
我需要将行添加到数据视图 我的代码如下
DataGridViewSelectedRowCollection row = dataGridView1.SelectedRows;
for (int o = 0; o < row.Count; o++)
{
DataRow myRow;
myRow = (row[o].DataBoundItem as DataRowView).Row;
DataRowView drv = dv2.AddNew();
drv = row[o].DataBoundItem as DataRowView;
}
它在调试模式下仅添加空白行我可以看到这些行中的数据,但它们只是不显示在 datagridview 上
非常欢迎任何帮助
I am in need to add row to the dataview
My code is as follows
DataGridViewSelectedRowCollection row = dataGridView1.SelectedRows;
for (int o = 0; o < row.Count; o++)
{
DataRow myRow;
myRow = (row[o].DataBoundItem as DataRowView).Row;
DataRowView drv = dv2.AddNew();
drv = row[o].DataBoundItem as DataRowView;
}
It adds just blank rows in debug mode I can see data in those rows but they just don't show on datagridview
Any help is very welcome
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的问题不是很清楚,但在绑定之前将行添加到您要进行数据绑定的任何内容中可能会更简单,然后它应该已经存在了。
Your question is not very clear but it would probably be simpler to add the row to whatever you are databinding to before binding and then it should already be there.