获取一个单元格的值Dtagrid[CurrentCell]

解决方案 »

  1.   

    如果是WinForm就是:DataGrid[行][列]
    如果是WebForm就是:DataGrid.Items[行].Cells[列].Text
      

  2.   

    是winForm的,有DataGrid[行][列]这样的用法么
      

  3.   

    某行的第一列:DataGrid[iRowIndex][0].Tostring()
      

  4.   

    某行的第一列:DataGrid[iRowIndex][0].Tostring()
      

  5.   

    //dataGrid选中行的行号
    int iRow = this.dataGrid1.CurrentCell.RowNumber;
    //dataGrid选中行的第一列的值
    this.dataGrid1[iRow,0].ToString();
      

  6.   

    还是用currentcell来取值吧,要不就用bindmanagerbase
      

  7.   

    this.dataGrid1[this.dataGrid1.CurrentRowIndex,0].ToString().Trim()
    当前行的第一列的值
    取之前先判断dataGrid行数是否为0
      

  8.   

    int iRow = this.dataGrid1.CurrentCell.RowNumber;
    this.dataGrid1[iRow,0].ToString();
      

  9.   

    我又在回答重复的问题.
    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
      

  10.   

    上面的已经回答过了
    所选行,第三列的,
    textBox3.Text=dataGrid1[dataGrid1.CurrentCell.RowNumber,2].ToString();
      

  11.   

    string A=this.dataGrid1 [行,列].ToString ();