Select newly added Row - DataGridView and BindingSource

前端 未结 5 1654
眼角桃花
眼角桃花 2020-12-11 08:01

I\'m adding a new Row to a BindingSource that is Bound to a DataGridView

source.AddNew();

After this, use BindingSource to get the newly ad

5条回答
  •  半阙折子戏
    2020-12-11 08:36

    Extending from Oliver Friedrich's answer, the function when created using the controls's property as shown in the designer will look like:

    private void drv_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e)
    {
        drv.Rows[e.RowIndex].Selected = true;
    } 
    

提交回复
热议问题