开发者

Using an (I)List<string> as the source for a DataColumn

I'm playing around wi开发者_运维技巧th the DataGridView control offered by .NET. Upon till now I seem to be unable to bind an (I)List to a DataColumn. Is this possible and how should I go around doing this?


I think this link will answer your question: Binding List to datagridview

If you bind a List<string> directly to the Datagridview, you will just get the Lengths of the string in the column since it is the only property on each string in the list. You need to set something up where the string itself will be available as a property. So the Datagridview.Datasource will be the instance of the class that enapsulates IList<> and Datagridveiw.Datamember will be set to the property that returns the string.


Maybe you should take a look at the BindingList class.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜