[英]Get a list of objects from DataGridView?
I am binding a list of objects to a DataGridView
like the following 我将对象列表绑定到
DataGridView
,如下所示
var list = new List<Value>();
list.Add(new Value() { Name = "test" });
list.Add(new Value() { Name = "second" });
dataGrid.DataSource = list;
After inserting, editing, deleting... how can I retrieve a List<Value>
from the DataGridView
? 插入,编辑,删除后...如何从
DataGridView
检索List<Value>
?
The gridview edits your existing list. gridview编辑现有列表。
The list
will reflect the current contents of the gridview. 该
list
将反映gridview的当前内容。
The DataSource property should contain those changes. DataSource属性应包含这些更改。
http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.datasource.aspx http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.datasource.aspx
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.