A bit about the stuff I've done


Thursday, 19 January 2012

Binding a datagridview to a list

Ok, so binding a grid to a list is easy, but what if you want changes in the list to be shown in the grid?
Well actually, it turns out, this is easy too - just not obvious.

Instead of using System.Collections.Generic.List<T>
use System.ComponentModel.BindingList<T>
It's exactly the same in all important regards, but it has the methods necessary for the grid to know that the list has changed

Easy huh!

No comments:

Post a Comment