首页 > 其他 > 详细

获取DatagridViw单元格内容

时间:2019-11-08 11:41:11      阅读:83      评论:0      收藏:0      [点我收藏+]

在DatagridViw事件下双击CellClick事件;

private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{
//获取行列索引
int row = dataGridView1.CurrentCell.RowIndex + 1;
int col = dataGridView1.CurrentCell.ColumnIndex + 1;
//获取单元格内容
string cell = dataGridView1.CurrentCell.Value.ToString();
MessageBox.Show("你点击的是第" + row.ToString() + "行,第" + col.ToString() + "列\n内容为:"+cell);
}

 技术分享图片

 

获取DatagridViw单元格内容

原文:https://www.cnblogs.com/zhongruanzikong/p/11818668.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!