Reading data from DataGridView in C#

后端 未结 5 1348
礼貌的吻别
礼貌的吻别 2020-12-01 14:40

How can I read data from DataGridView in C#? I want to read the data appear in Table. How do I navigate through lines?

5条回答
  •  死守一世寂寞
    2020-12-01 15:08

    If you wish, you can also use the column names instead of column numbers.

    For example, if you want to read data from DataGridView on the 4. row and the "Name" column. It provides me a better understanding for which variable I am dealing with.

    dataGridView.Rows[4].Cells["Name"].Value.ToString();
    

    Hope it helps.

提交回复
热议问题