c# winform获取gridview数据

c# winform获取gridview数据

 

        //取单元格数据三种方法
        this.dataGridView1[e.ColumnIndex, e.RowIndex].Value.ToString();//第一种取法
        this.dataGridView1.Rows[e.RowIndex].Cells["你所要取值的列名称"].Value.ToString();//第二种取法
        this.dataGridView1.CurrentRow.Cells["你所要取值的列名称"].Value.ToString();//第三种取法

        注意读取时单元格数据为null

 

posted @ 2023-03-29 12:02  txwtech  阅读(1057)  评论(0编辑  收藏  举报