且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

当datagridview被限制为空数据表时,如何向datagridview添加行

更新时间:2023-12-06 16:46:10

数据表是网格视图的数据源。因此,如果要向视图添加项目,则必须将它们添加到其数据源。

您应该使用 DataTable.NewRow方法 [ ^ ]而不是。

不知道数据表的模式,它很难提供更具体的答案,但链接举例说明方法的用法,你可以从它开始,看看它在哪里。

希望这会有所帮助。
The datatable is the data source for your grid view. So, if you want to add items to the view, you have to add them to its data source.
You should use DataTable.NewRow Method[^] instead.
Not knowing the schema of the datatable, it is hard to provide a more concrete answer, but the link holds an example of method's usage, and you can start with it and see where it gets you.
Hope this helps.