I use WinForms data binding to display data from a database mapped to Fluent NHibernate, and this works great.
For example, I can just set the DataSource DataGridView property from the IList object property, and voila - there is all the data!
But now I need to start adding and saving new rows of data, and this is not so good. I thought I could just turn on the AllowUserToAddRows property of the grid, and new lines would be added to the underlying IList in essence, but that didn't work.
Then, after a little search, I tried to set the DataSource property to a BindingList that was populated from IList, but this is not updated with new lines.
During my searches, I also met several people who reported difficulties with WinForms and DataBinding in general, which makes me wonder if I will continue this approach.
Is the DataBinding approach appropriate? If so, can anyone suggest where I am wrong?
Or is it best to handle all the DataGridView events associated with adding a new row and writing custom code to add new objects to the IList property in my object?
Other offers? (although I don't think switching to WPF would be an option, no matter how much better data binding could be)
source
share