How to get column value of grid in C# Windows application?

前端 未结 4 1530
庸人自扰
庸人自扰 2021-02-11 01:36

How to get column value of grid in C# Windows application?

When I clicked on the cell, at that time it should get column values.

private void gridAgentD         


        
4条回答
  •  难免孤独
    2021-02-11 01:45

    try this eventHandler: [I tried with this and i got result]

        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            int rowIndex = e.RowIndex;
            int colIndex = e.ColumnIndex;
            MessageBox.Show(dataGridView1[colIndex, rowIndex].Value.ToString());
        }
    

提交回复
热议问题