I would like to insert a new DataGridViewRow into my DataGridView at a specific index. If I just create a new Row like
DataGridViewRow dgwr = new DataGridViewRow();
datagridview1.Rows.Insert(index, dgwr);
I will not get the “settings” of the DataGridView, like for example my “Cells” will be 0. This does not happen if I use.
DataGridView1.Add();
But then again, then I cant chose where in the list I would like my post…
Is there anyway to combine these advantages?
/Nick
This inserts 1 empty templated row at ‘index’, and then simply accesses row in ‘index’.
The 2nd line is for accessing the just-now-added row.
Can also shorten if you know your wished row values with:
Just have to make sure it is synced with the columns order in the grid, and it makes the row automatically with these fields.