Rows cannot be programmatically added to the DataGridView's rows collection when the control is data-bound
c#, datagridview, visual-studio-2008
Solution
The cause is that "Rows cannot be programmatically added to the DataGridView's rows collection when the control is data-bound". It is as clear as crystalline water
The solution? Do not add rows to the DataGridView's rows collection, add them to the underlying datasource collection (the collection you are setting in to the DataSource property of the DataGridView)
Problem
I have a grid and when data is loaded in grid; I simply select a row and press edit button. On edit, new sub form is opened and values of row's cells are passed to controls on sub form. But, when I change some values on sub form and save them to be replaces in grid the error comes to me: Rows cannot be programmatically added to the DataGridView's rows collection when the control is data-bound. What is cause of this error and how to overcome this.