string  strGradeID=dsGrade.Tables[0].Rows[dgrdGrade.CurrentCell.RowNumber]["ID"].ToString();
dsGrade是你绑定到DataGrid中的DataSet,通过这个代码就可以把列号为“ID”的内容赋给字符串。

解决方案 »

  1.   

    得到当前选中行的第一列数据:
    dataGrid1[dataGrid1.CurrentRowIndex,0].ToString().Trim();
    依次类推。
      

  2.   

    to:  wxfwxfwxfwxf(wxfwxfwxfwxf)、 mswater(起点低/底子薄)
        两位提供的方法都忽略了一个问题:排序。
        当用户在DataGrid上单击某一列的列头后,DataGrid会按照单击的列进行排序,而DataSet的排序还是没变,这样CurrentRowIndex、CurrentCell.RowNumber的序号都和DataSet中的对不上了
      

  3.   

    DataGrid是可以多选的,你只能通过遍历来取得,例如:
    string s="";
    for (int i=0;i<this.dataGrid1.BindingContext[this.dataGrid1.DataSource].Count;i++)
    {
    if (this.dataGrid1.IsSelected(i))
    {
    s+=((DataView)((CurrencyManager)this.dataGrid1.BindingContext[this.dataGrid1.DataSource]).List)[i][0].ToString()+Environment.NewLine;
    }
    }
    MessageBox.Show("The lines you selected are :"+s);如果你想得到左边的箭头指向的项,你可以用下面的办法
    DataGrid dataGrid1;
    ...
    DataRow dr=((DataRowView)this.dataGrid.BindingContext[this.dataGrid1.DataSource].Current).Row;
      

  4.   

    DataRow dr = this.ds.Tables[0].DefaultView[  this.dataGrid.CurrentRowIndex].Row;我用过,没有任何问题!1