datagridview 单击单元格获取单元格的内容

时间:2021-09-27 19:17:24

//单击单元格获取单元格的内容
 private void dataGridViewX1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                SelectPowerObjid = this.dataGridViewX1.CurrentRow.Cells["objid"].Value.ToString();
                SelectPowerId = this.dataGridViewX1.CurrentRow.Cells["ID"].Value.ToString();
            }
            catch(Exception ex){
            
            }
      
        }