如何取得datagrid中某一行(一个单元格)的值 获取一个单元格的值Dtagrid[CurrentCell] 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 如果是WinForm就是:DataGrid[行][列]如果是WebForm就是:DataGrid.Items[行].Cells[列].Text 是winForm的,有DataGrid[行][列]这样的用法么 某行的第一列:DataGrid[iRowIndex][0].Tostring() 某行的第一列:DataGrid[iRowIndex][0].Tostring() //dataGrid选中行的行号int iRow = this.dataGrid1.CurrentCell.RowNumber;//dataGrid选中行的第一列的值this.dataGrid1[iRow,0].ToString(); 还是用currentcell来取值吧,要不就用bindmanagerbase this.dataGrid1[this.dataGrid1.CurrentRowIndex,0].ToString().Trim()当前行的第一列的值取之前先判断dataGrid行数是否为0 int iRow = this.dataGrid1.CurrentCell.RowNumber;this.dataGrid1[iRow,0].ToString(); 我又在回答重复的问题.dgMain.CurrentCell.RowNumber修改当前行取出当前行对应的DataTable的值。如下:DataRowView drv = (DataRowView)this.BindingContext[this.ds,this.ds.Tables[0].TableName].Current;获取到drv就可以改数据了还可以获取DataRow drow = drv.Row; http://www.syncfusion.com/FAQ/WinForms/FAQ_c44c.asp 上面的已经回答过了所选行,第三列的,textBox3.Text=dataGrid1[dataGrid1.CurrentCell.RowNumber,2].ToString(); string A=this.dataGrid1 [行,列].ToString (); 怎么实现多文档窗体,在主窗体左边实现树形菜单,但子窗体不会盖住树形菜单,请问怎么实现 c#中获取excel中的数据需要的命名空间是什么 SQL数据库问题 winform 读取网页源文件 c/s模式下,如何让textbox大小随着窗口大小的变化自适应调整 在用户机器中安装netframework2.0可再发行组件包后,为何在控制面板中没有netframework 配置? 想在Remoting中实现在线用户统计,如何实现? 瞧点的问题 大家帮我看下这段代码,谢谢了 高手请帮忙~ 强烈建议版主进来,不同意也作为参考看看。 在WINFORM中,怎样对数据表汇总
如果是WebForm就是:DataGrid.Items[行].Cells[列].Text
int iRow = this.dataGrid1.CurrentCell.RowNumber;
//dataGrid选中行的第一列的值
this.dataGrid1[iRow,0].ToString();
当前行的第一列的值
取之前先判断dataGrid行数是否为0
this.dataGrid1[iRow,0].ToString();
dgMain.CurrentCell.RowNumber修改当前行
取出当前行对应的DataTable的值。
如下:
DataRowView drv = (DataRowView)this.BindingContext[this.ds,this.ds.Tables[0].TableName].Current;
获取到drv就可以改数据了
还可以获取
DataRow drow = drv.Row; http://www.syncfusion.com/FAQ/WinForms/FAQ_c44c.asp
所选行,第三列的,
textBox3.Text=dataGrid1[dataGrid1.CurrentCell.RowNumber,2].ToString();