Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set the "insert new row" as first row in DataGridView

I am trying to get the DataGridView to render the "insert new row" row as the first row in the grid instead of the last row. How do I go about doing that, is it even possible in the control?

like image 833
Egil Hansen Avatar asked Nov 04 '08 23:11

Egil Hansen


1 Answers

I don't think there is any way to move the "new row" row to the top of the data grid.

But, what if you left the top row empty and as the data filled in move the row down as appropriate? In other words, make your own "new row" row, which is just first row in the grid and add new blank rows above when editing is over.

   Dim myrow = existingDataTable.NewRow

    existingDataTable.Rows.Add(myrow)

    adp.Fill(existingDataTable)
    With DataGridView1
        .DataSource =existingDataTable
    End With    
like image 156
jons911 Avatar answered Nov 09 '22 13:11

jons911