How to programmatically set cell value in DataGridView?

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

    The following works. I may be mistaken but adding a String value doesn't seem compatible to a DataGridView cell (I hadn't experimented or tried any hacks though).

    DataGridViewName.Rows[0].Cells[0].Value = 1;
    

提交回复
热议问题