views:

69

answers:

1

DataGridView in .Net has built-in support for adding new items at the bottom. Last row is treated in a special way. The IBindingSource interface supports this through AddNew/EndNew/CancelNew methods. Is it possible to change this to allow adding items in the top row of the grid instead?

I know I can do sourceList.Insert(0, item) programmatically for a start, but devil is in the details and I wonder if there is already a way to do this.

The data is coming from a bound IBindingList (not a database).

A: 

Can you add a insert DateTime column and sort the grid to this column ? (one solution) If you really really need this feature, consider using a 3rd party grid like JANUS or DevExpress and check if they support it.

also check out:

SO Old Question

Dani
IIRC, even with a sorted `DataView` it appends to the bottom and only re-sorts when you commit the row. I could be wrong, though.
Marc Gravell
(I mention `DataView` because it is one of the few types that supports the gamut of interfaces consumed by `DataGridView` in this scenario)
Marc Gravell
I think you are right about that. only after you commit the row...
Dani