I have a DataGridView
in C# and I want to add rows in a programmatic way. There is no data bound to the grid but when I call dataGrid.Rows.Add();
it throws a System.InvalidOperationException
.
I looked all over the internet and I only found this problem for people who have data bound to it. I want the grid to be controlled completely from the code.
Could anyone help me with this please?
Not sure if it makes a difference but I use .Net framework 3.5.