Hiii Members,
I am working on a C# WinApp. In a form there are two ComboBoxes and one DataGridView. the first ComboBox contains customer names, the second ComboBox contains products (fruits, vegitables, house holds etc). I have wrote a code that some customers have pre-added products saved in a DataTable so, when I select the customer's name from ComboBox, the pre-saved products automatically loads into the DataGridView.
problem is when I try to add a new product for the customer, system throws error, "ColumnCount property cannot be set on a data-bound DataGridView control."
when remove the ColumnCount property, it throws another error, "Rows cannot be programmatically added to the DataGridView's rows collection when the control is data-bound."
I have googled many times but no solution working for me. DataGridView.DataSource = null; will not work because I want to add more row in existing (pre-loaded) list.
Please show me anyway to add a row in a databound datagridview C# WinApp.
Thanks
Mayank Jani

Piyush PansuriyaRank #454 · 5.5K reputationPosted Sep 29, 2019, 8:47 PM EDT
Mayank JaniRank #2,449 · 575 reputationPosted Oct 3, 2019, 8:30 AM EDT
Amit MohantyRank #112 · 20K reputationPosted Oct 3, 2019, 8:40 PM EDT
Amit GuptaRank #190 · 12.8K reputationPosted Oct 4, 2019, 7:32 AM EDT
Mayank JaniRank #2,449 · 575 reputationPosted Oct 4, 2019, 8:19 AM EDT
Amit GuptaRank #190 · 12.8K reputationPosted Oct 4, 2019, 11:07 AM EDT
Mayank JaniRank #2,449 · 575 reputationPosted Oct 8, 2019, 4:39 AM EDT