-2

如何在 C#中绑定List<>到?DatagridView

List<Item> itemList = new List<Item>();
4

3 回答 3

5

应该看起来像这样:

var bs = new BindingSource();
var list = new List<YourType> { ... };
bs.DataSource = list;
grid.DataSource = bs;
于 2013-05-23T05:14:10.067 回答
1

它应该工作

 BindingList<MyList> Categories = new BindingList<MyList>();
            Categories.Add(new MyList("Hello"));

            dataGridView1.DataSource = Categories;          
于 2013-05-23T05:18:57.720 回答
-1

您可以像这样简单地绑定它

List<object> itemList = new List<object>();
grid.DataSource = itemList;
grid.DataBind();
于 2013-05-23T05:15:11.807 回答