Sunday, September 30, 2007

BindableList

I've been working on a programming project at work that will be a data entry front end to an MS Access database. Saturday I was working on binding a DataGridView control to a generic list of custom objects returned from a function that queries the database. Everything worked fine when the form was initially loaded, but any edits to the data were not pushed back to the underlying list. It took a few attempts at firing the DataGridView's update and refresh methods before I realized this. After a few more minutes searching the internet I found that I need to use the BindableList(Of T) in the System.ComponentModel namespace. After changing the references to this new type, everything works great! What I want to know is why this type is in the ComponentModel namespace instead of the Generics namespace along with the List(Of T) type. I will have to do a little more research on this one.

No comments: