怎么获dataGridView中的数据 C#运行时出现dataGridView这个表格,我想鼠标点击哪一行,然后MessageBox就显示这行的全部信息。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 用CellClick事件dgv.Rows[e.RowIndex].Cells["NAME"].Value.ToString(); private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) { string tmpDisplay = string.Empty; for (int i = 0; i < this.dataGridView1.ColumnCount; i++) { tmpDisplay = tmpDisplay + this.dataGridView1.Rows[e.RowIndex].Cells[i].Value.ToString(); } MessageBox.Show(tmpDisplay); } 最好的方式不是这个,而是使用BindingSouce做中介那么dataGridView1_CellContentClick里面 this.bindingSource1.Current 对象就是lz要的东西 求一算法.... 关于栈的问题 光标离开dataGridView中的一列后怎么写方法? 怎么判断Access数据已被删除? 创建并调用存储过程 无刷新联动取不到值的 问题 怎样在页面没有焦点的情况下,当用条形码扫描仪进行录入时,自动到某个指定的text框中? 如何让ListView的某一栏如:columns[3],不能让用户拉动 高分求助!文件分割合并问题 linked clone C#代码图片识别分割,看不懂求注释 C#添加新项目中没有其他项目
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
string tmpDisplay = string.Empty;
for (int i = 0; i < this.dataGridView1.ColumnCount; i++)
{
tmpDisplay = tmpDisplay + this.dataGridView1.Rows[e.RowIndex].Cells[i].Value.ToString();
}
MessageBox.Show(tmpDisplay);
}