winform dataGridView中的button点击判断

Posted on 2017-04-12 14:59  熊先生丶  阅读(301)  评论(0编辑  收藏  举报
 private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex >= 0)
            {
                DataGridViewColumn column = dataGridView1.Columns[e.ColumnIndex];
                if (column is DataGridViewButtonColumn)
                {  
                   //要做的事
dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString()//获取点击行的第二个表格的值 } } }