开发者

Windows Forms: DataGridView Binding Question

开发者 https://www.devze.com 2023-01-18 15:32 出处:网络
I have a Winform DataGridView, which has a number of predefined columns. Now I have an array of objects (the object structure conforms to the defined gridview columns) and I want to bind the gridview

I have a Winform DataGridView, which has a number of predefined columns. Now I have an array of objects (the object structure conforms to the defined gridview columns) and I want to bind the gridview to this array (with gridview.datasource = array)

The problem is now, that I get several new columns in the grid after the predefined columns (the predefinded columns remain empty). How can I achive, that the array data 开发者_开发百科is loaded into the predefined columns?


You need to set the DataPropertyNames of the existing columns to match the properties of the objects in the array.

0

精彩评论

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