Make new row dirty programmatically and insert a new row after it in DataGridView

前端 未结 4 408
没有蜡笔的小新
没有蜡笔的小新 2021-01-18 04:37

I\'ve an editable unbounded datagridview. I\'m changing the value of new row programmatically.

Normally, when user types in any field of a new row, it becomes dirty

4条回答
  •  攒了一身酷
    2021-01-18 05:09

    This is really really late considering the question timeframe, but the accepted answer did not work for me. What ended up resolving it for me was first inserting a row above the dirty row, then editing that 'clean' row instead.

    if (e.RowIndex == myGrid.Rows.Count - 1)
    {
        myGrid.Rows.Add();
    }
    myGrid[e.ColumnIndex, e.RowIndex].Value = etd.ResultText; // Edit at your leisure.
    

提交回复
热议问题