Get a list of objects from DataGridView?
I am binding a list of objects to a DataGridView
like the following
var list = new List<Value>();
list.Add(new Value() { Name = "test" });
开发者_JAVA技巧list.Add(new Value() { Name = "second" });
dataGrid.DataSource = list;
After inserting, editing, deleting... how can I retrieve a List<Value>
from the DataGridView
?
The gridview edits your existing list.
The list
will reflect the current contents of the gridview.
The DataSource property should contain those changes.
http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridview.datasource.aspx
精彩评论