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

前端 未结 4 1517
庸人自扰
庸人自扰 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 02:02

    To get the Values of the Selected Cells Follow the Below Code

    int CNo = datagrid.CurrentCellAddress.Y;
    
    int StNum = (int)datagrid.Rows[CNo].Cells[0].Value;
    
    string StName = (string)datagrid.Rows[CNo].Cells[1].Value;
    
    int MrksSecured = (int)datagrid.Rows[CNo].Cells[2].Value;
    

提交回复
热议问题