Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

DataGridView displaying results from BindingSource but not custom class.

$
0
0

Hello all:

C#.Net 4.0 Winforms app. I have databound DataGridViews to custom classes in the past. Today I had one that would not display the data in the underlying class though there weas data present. When I wrap the custom class in a BindingSource, and bind the DataGridView to that, the grid shows the data.

What would cause that? The custom class implements INotifyProperyChanged. The grid has preset columns and .AutogenerateColumns is set to false. I simple do grid.DataSource = myCustomClass;

That fails to populate the grid. But If I do:
BindingSource myBS = new BindingSource();
myBS.dataSource = myCustomClass;
grid.DataSource = myBS;

... then the grid displays data.

Thanks for any input.

Kurt


Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>