DataGrid new row at top ?

Jarod

Regular
Joined
Feb 5, 2003
Messages
82
Location
Bruxelles
I have a dataGrid which will be sorted anti chronologically (most recent records at top)
And I want the user to be able to add new records.

To do that, I have added a date column to my data source with a default value and sort the datasource on that column :

Visual Basic:
    'dt is a DataTable filled with my other columns

    dim dc as New DataColumn("CREATION_DATE", GetType(Date))
    dc.DefaultValue = Date.Now
    dt.Columns.Add(dc)

    Dim myView As DataView = dt.DefaultView
    myView.Sort = "Creation_Date DESC"
    Me.DataGrid1.DataSource = myView

So when a user enter a new record, this one will be automatically put at the top of my DataGrid.

That's what I want, but as the last inserted record will allways be the most recent (date column set to read only), that would be nice to have my new row at the top of my DataGrid and not at the bottom.
Is this possible ?
Thanks,
 
Back
Top