GridControl當前行的RowHandle


//得到當前行的RowHandle  
  myDataRow   myDataRow=gridView1.GetDataRow(gridView1.FocusedRowHandle);  
  //去出你想要的字段  
  F_DriverName=myDataRow["DriverName"].ToString();

 

獲取GridControl當前選中行的值方法很多。
其中一種在當前行獲取焦點時取值。
        private void gridView1_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
        {
            string tableKey = this.gridView1.GetRowCellValue(e.FocusedRowHandle, "TableKey").ToString();
            MessageBox.Show(tableKey);
        }
其中TableKey為GridControl列的FieldName屬性。
效果圖:


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM