Forgot too... when you add a row, it adds to the end.
Do you have a column that you can use for an index or sort on? I'd say if
there is, you may be able to add the row, set the key column, and then
refresh the datagridview? To borrow a very old method used in the old days
of BASIC...
you could have each row with a column having a sequence number, say 10, 20,
30, 40... and when you add a row, you could insert a row say at 15. You may
have to "re-align" the rows on the fly if you start adding a lot of rows
however.
I haven't tried it, but this almost seems like a task for a Doubly-Linked
list.
"SerenityPCCS" wrote:
Try adding a row to the DataTable, and not the DataGridView
Try something like:
DataRow myNewRow;
myNewRow = myDataSet.myDataTable.NewRow(); // assuming typed dataset
myNewRow[0] = ...
myDataSet.myDataTable.Rows.Add(myNewRow);
"Chris" wrote:
AllowUserToAddRows = true
I am trying to add them programatically.
I see an error that you cannot when the datagridview is bound to a dataset.
If the edit a row, then a new row appears automatically at the last row.
I need to "insert" a row before or after a selected row then add data to it.
"Nicholas Paldino [.NET/C# MVP]" wrote:
Chris,
>
Can you show an example? What is it databound to? Is the
AllowUserToAddRows property set to true on the DataGridView? Or are you
getting an error when trying to do this programattically?
>
>
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
>
"Chris" <Ch***@discussions.microsoft.comwrote in message
news:2F**********************************@microsof t.com...
how do you insert a new row to a databound datagridview? It won't allow
this
action.
>
>
>