无法以编程方式添加行。 [英] Rows Cannot be Programmatically added.

查看:104
本文介绍了无法以编程方式添加行。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿伙计们,当我想在我的dataGridView中添加一个文件时,我收到了一个错误,我无法添加任何数据,因为它是数据绑定的。我一直在努力解决这个问题,但仍然给了我同样的错误。下面是代码的片段:

Hey guys, I''m getting an error when I want t add a file to my dataGridView that I can''t add any data because it is databound. I''ve been working around this but still gives me the same error. heres the snippet of the code:

展开 | 选择 | Wrap | 行号

推荐答案

我会创建并填充数据表然后将GridView的数据源设置为数据表。
I would instead create and populate a datatable and then set the datasource of your GridView to the datatable.


嗯。我会看看那个。那么我会在哪里放置正确的陈述等?
Hmm. I''ll have a look at that. Where would I place the right statements etc then?


您的代码现在几乎就在那里。首先创建一个新的数据表,并在第一个循环中添加列,填充gridview列。
Your code is almost there right now. First create a new datatable and add the columns inside your first loop where you''re populating your gridview columns.
展开 | 选择 | Wrap | 行号


这篇关于无法以编程方式添加行。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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