Thursday, April 3, 2008

LINQ to SQL and the DataGridView control

A DataGridView control won't bind directly to an IEnumerable object, so two options are:

1. Create a BindingSource, set its DataSource to the IEnumerable object, then set the DataGridView.DataSource property to the BindingSource.

2. Bind the DataGridView.DataSource property to the IEnumerable object's ToList() method.

Thanks to Ken Tucker on Microsoft Forums for this tip.

2 comments:

Unknown said...

Dude, saved me! ;] very nice indeed

gardiniandoli said...

A Caucasian is playing at a casino near me (or some
This is an article 서산 출장마사지 about a Caucasian in our casino gaming community! A Caucasian is 창원 출장샵 playing at a casino 태백 출장샵 near 문경 출장마사지 me (or some other casino) 경기도 출장안마