C# .NET - Rows cannot be programmatically added to the DataGridView's rows collection when the contr
Asked By kavitha varma on 19-Jun-12 01:52 AM
Rows cannot be programmatically added to the DataGridView's rows collection when the control is data-bound.
Jitendra Faye replied to kavitha varma on 19-Jun-12 01:58 AM
I think you are trying to add row in DataGridView using code.
Follow these links-
http://stackoverflow.com/questions/5731389/adding-elements-to-the-collection-through-datagridview
http://social.msdn.microsoft.com/Forums/en-US/winformsdatacontrols/thread/afa42681-84db-4e16-93e1-80afe0b1ff5b/
http://stackoverflow.com/questions/8708057/rows-cannot-be-programmatically-added-to-the-datagridviews-row-collection-when
Here you will get different example for this.
dipa ahuja replied to kavitha varma on 19-Jun-12 03:52 AM
If you have already bind the datagridview with the table, then you cannot add the rows dynamically. because it is bonded to table.
If you want it dynamically add the rows, then you have to bind it locally with the datatable.