你要得到dataset中的当前表的当前记录的值,则可以用如下方法
DataRow cruRow=ataSet.Tables[表名].Rows[myBind.Position];//返回当前行
string cruColumn=ataSet.Tables[表名].Rows[myBind.Position][列名].ToString();//返回当前行指定列的值

解决方案 »

  1.   

    以下是在msdn中的例子本示例从现有的 DataGrid 控件(由整数值填充)中检索选定的数据。示例
    System.Windows.Forms.DataGridCell selectedCell = dataGrid1.CurrentCell;
    object selectedItem = dataGrid1[selectedCell.RowNumber, selectedCell.ColumnNumber];
    int cellValue = Convert.ToInt32(selectedItem);
    编译代码
    本示例需要: 名为 dataGrid1 的 DataGrid 控件。 
    可靠编程
    如果 DataGrid 未绑定到某一数据源或者未选定任何单元格,则选定的单元格就是行 0 和列 0 中的单元格。以下情况可能会导致异常: DataGrid 控件未绑定到数据源(InvalidOperationException 类)。 
    该单元格的数据类型中不包含您试图转换成的数据类型(InvalidCastException 类)。 
      

  2.   

    winForm中:this.dataGrid1[this.dataGrid1.CurrentRowIndex,0].ToString();//当前选中行第一个Cell的值
      

  3.   

    确定当前行号,再是列值。
    其实DataGrid索引器就像是一个二维数组。
    如获取所有列:
    for(int i=0;i<dg.VisibleRowCount;i++)
    {
    for(int j=0;i<dg.VisibleColumnCount;j++)
    {
    MessageBox.Show(dg[i,j].ToString());
    }
    }
      

  4.   

    yourdatagrid[CurrentCell.RowNumber,CurrentCell.ColumnNumber].tostring()
      

  5.   

    打错了
    dataGrid1[dataGrid1.CurrentCell]
      

  6.   

    object currentValue=dataGrid1[dataGrid1.CurrentCell];
      

  7.   


    winForm 还是 WebForm?不一样的。
    winForm 里自动取值,在event里直接编程就行
    WebForm 可以给定所在的行列值。
    看你的功能需要了