码迷,mamicode.com
首页 > 其他好文 > 详细

获取DatagridViw单元格内容

时间:2019-11-08 10:44:52      阅读:112      评论:0      收藏:0      [点我收藏+]

标签:ring   wce   upload   index   str   ESS   ntc   show   send   

在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单元格内容

标签:ring   wce   upload   index   str   ESS   ntc   show   send   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!