开发者

Get a list of objects from DataGridView?

开发者 https://www.devze.com 2023-02-22 09:50 出处:网络
I am binding a list of objects to a DataGridView like the following var list = new List<Value>();

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

0

精彩评论

暂无评论...
验证码 换一张
取 消