How to programmatically set cell value in DataGridView?

前端 未结 14 890
無奈伤痛
無奈伤痛 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:55

    I tried a lot of methods, and the only one which worked was UpdateCellValue:

    dataGridView.Rows[rowIndex].Cells[columnIndex].Value = "New Value";
    dataGridView.UpdateCellValue(columnIndex, rowIndex);
    

    I hope to have helped. =)

提交回复
热议问题