Don Ireland

Don Ireland

  • NA
  • 27
  • 7k

Bind anonymous data type to DataGridView

Apr 4 2014 10:00 AM
I have a LINQ query that returns an anonymous data type.  I'm trying to figure out how to bind this data to the DataGridView that's in my WinForm.

I've read about doing myDataGridView.Source = myData.  But the data doesn't exist until runtime (I've got a function that runs at specific events like FileNewClicked and myDataGridView2.SelectedItemChanged.  This function performs the query).  Because the data doesn't exist until runtime, the designer isn't allowing me to assign columns to the data.

Can someone point me in the right direction?

TIA!

Answers (14)