How to programmatically set cell value in DataGridView?

前端 未结 14 878
無奈伤痛
無奈伤痛 2020-11-30 02:05

I have a DataGridView. Some of the cells receive their data from a serial port: I want to shove the data into the cell, and have it update the underlying bound object.

14条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-30 02:56

    Try this way:

    dataGridView.CurrentCell.Value = newValue;
    
    dataGridView.EndEdit();
    
    dataGridView.CurrentCell.Value = newValue;
    
    dataGridView.EndEdit();
    

    Need to write two times...

提交回复
热议问题