I'm building a small vb app using the latest version of the .net compact framework. The datagrid control is a bit more limited than I'm used to.
I'm seeing lots of examples where I can bind the grid's datasource to a dataset/datatable. Is it possible to bind to a generic list? If so, how?
Best Answer
You can just add the list to the datasource, but then you need to do some more work to get the columns to look the way you want.
I do this all the time actually, but it is a little involved. Note that my example is using .net 3.5 and some of the C# 3.0 features to make it easier.
First, here are the extension methods I'm using:
And this little class:
That is the setup, here is the payoff: Taking a generic list, spesifying the column names, and their widths: