如何设置"插入新行"在DataGridView的第一行如何设置、QUOT、DataGridView

2023-09-04 00:32:31 作者:幸福甜蜜的,女生幸福

我想获得在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?

推荐答案

我不认为有任何方式的新行一行移动到数据网格的顶端。

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