怎样获取DataGridView控件中当前选中行的所有值
解决方案 »
- 有关c#计箅器算法的问题
- 初学者新编的C#计算器代码,另外KeyPress事件想不到该怎么简单的实现,求助...
- 等了好久都没等到结果,二进制输出,把剩余的分都给你【急】
- C1TrueDBGrid的标头问题 又100分献上
- 如何实现像千千静听一样的多个分割窗体
- 请教:如何制作如下的自定义属性?
- 如何将DataSet里面的数据写入Excel并且第一行要是列名
- VS2005水晶报表中IFieldObject的问题
- DataSet.Merge(ds1)之后,如何将更新写入数据库?
- 如何将文本内容导入到Access数据库中?各位大侠,快帮帮忙T_T
- C#调用C++的dll老报错: Attempted to read or write protected memory.
- 如何从一个文本文件读到另一个文本文件[同名]
获取对 GridViewRow 对象的引用,该对象表示控件中的选中行。
void CustomersGridView_SelectedIndexChanged(Object sender, EventArgs e)
{ // Get the currently selected row using the SelectedRow property.
GridViewRow row = CustomersGridView.SelectedRow; // Display the company name from the selected row.
// In this example, the third column (index 2) contains
// the company name.
Message.Text = "You selected " + row.Cells[2].Text + "."; }像上面那样获取每个列的数据,然后传递给下一个页面。
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
{
textBox1.Text =dataGridView1.Rows[dataGridView1.CurrentRow.Index ].Cells["id"].Value.ToString() ;
}
谢谢~ 这样也是一个值一个值获取把 ??
我是想直接取一行值然后传递这一行~
DataRow row = dstresult.Tables[0].Rows[dgView.CurrentRow.Index]
就是这样的