1. DataGridView Data Binding comparison (DataTable and generic list):
When DataGridView's DataSource is a DataTable, the data in the DataTable changes, and DataGridView data changes without having to rebind to DataGridView.
When the DataGridView datasource is a generic list, when the list data changes, you need to first set the DataSource of DataGridView to New List<t> () and then the changed list<t > Assigned to DataGridView's datasource.
When binding list, note: Do not set DataGridView's DataSource to null, otherwise it will break the DataGridView column structure.
2. Adding and removing problems after data binding:
If you want to bind the DataGridView in the list<t> to add data to delete, first to convert list<t> to Bindinglist<t> Bind again: Datagridview.datasource=new bindinglist<t> (New list<t>). Otherwise, there will be many unexpected mistakes.
such as: After the initial binding of the empty data after the addition of data binding, but the Datagridview.currentcell property is not taken.
3. You can still add deletes using generic bindings:
ilist<t> list= new list<t> ();
Datagridview.datasource=list;//datagridview rows cannot be added and deleted;
Datagridview.datasource=new bindinglist<t> (list);//datagridview rows can be added to delete (only allow rows to be added, row deleted).
Go DataGridView binding Generic List of various