12-07-2020 10:02 AM
Trying to use DataGrid.
I have used Mike King's example to add data when my app starts:
Now I am trying to change the data to a whole different array of the same size and shape. In this case it is just hand entered values to test with:
I am getting the following error. Why? What is the proper way to add new data when the DataGrid is already initialized? IF the control is databound how do I update the object that is providing the data?
Error 1172 occurred at Invoke Node Error calling method System.Windows.Forms.DataGridViewRowCollection.Add, (System.InvalidOperationException: Rows cannot be programmatically added to the DataGridView's rows collection when the control is data-bound.)
12-09-2020 05:58 PM
I'm going off memory here, but the dataTable is what is bound to the grid, so you use the methods to alter the data table directly and the grid auto updates. There are already add Row, delete row, edit row, clear and other functions to use with the dataTable. Look in the source/DataTable/ folder for all that stuff.