获取选中datagrideview行的列值 怎样获取选中datagrideview行的列值 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 datagrideview[行,列].value.tostring()保定软件开发群126802262 datagridview.selectedrows[0].cells["列名"].value.tostring() DataGridView.CurrentCell 获取或设置当前处于活动状态的单元格。 DataGridView.CurrentCellAddress 获取当前处于活动状态的单元格的行索引和列索引。 DataGridView.CurrentRow 获取包含当前单元格的行。 DataGridViewCell.Selected 获取或设置一个值,该值指示是否已选定该单元格。DataGridViewCell cell = DataGridView.Rows.Cells[columnIndex];if(cell != null) cell.Selected = true; if (this.grvContractList.RowCount < 1) //判定选中了 DataRow dr = this.grvContractList.GetDataRow(this.grvContractList.FocusedRowHandle);//获取选中行 private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { textBox1.Text =dataGridView1.Rows[dataGridView1.CurrentRow.Index ].Cells["id"].Value.ToString() ; textBox2.Text = dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells["name"].Value.ToString(); }int rowIndex = dataGridView1.currentCell.rowIndex;object value = dataGridView1.rows[rowIndex].cell["columnName"].value; 4楼是WINFORM应用6楼是ASP.NET应用基本上能满足LZ的简单需求了 看错了,6楼也是WINFORM...请无视我。。 winform中如何判断电脑上是否有摄像头,高手请进 关于数据集XSD的问题 应用程序打包部署的的问题!! 关于com问题???? 关于vs2005发布部署问题 HttpWebRequest 读取网站返回为中文成乱码请指导员 如何在窗体中播放powerpoint文件 在线阅读PDF文件,限制拷贝、打印、另存为 怎么让客户自己定义报表,怎么做? 哪里有有关VC++7.0,C#的书籍下载? grid表行相互转换 在asp.net mvc 中js文件中的方法怎么转到controller层中的方法
保定软件开发群126802262
DataGridView.CurrentCellAddress 获取当前处于活动状态的单元格的行索引和列索引。
DataGridView.CurrentRow 获取包含当前单元格的行。 DataGridViewCell.Selected 获取或设置一个值,该值指示是否已选定该单元格。DataGridViewCell cell = DataGridView.Rows.Cells[columnIndex];
if(cell != null) cell.Selected = true;
DataRow dr =
this.grvContractList.GetDataRow(this.grvContractList.FocusedRowHandle);//获取选中行
{
textBox1.Text =dataGridView1.Rows[dataGridView1.CurrentRow.Index ].Cells["id"].Value.ToString() ;
textBox2.Text = dataGridView1.Rows[dataGridView1.CurrentRow.Index].Cells["name"].Value.ToString();
}
int rowIndex = dataGridView1.currentCell.rowIndex;
object value = dataGridView1.rows[rowIndex].cell["columnName"].value;
6楼是ASP.NET应用
基本上能满足LZ的简单需求了