在DataGrid的AllowSorting值为True的情形下,利用CurrentRowIndex来取DataTable中相应的Row是不大妥当的。
'在随意中进行了某列排序后,CurrentRowIndex与DataTable的“CurrentRowIndex”就有可能不相符,
'DataTable1.Rows[DataGrid1.CurrentRowIndex]可能并不是你真正要的。
'稳妥的方法可以这样:
CurrencyManager MyCurrencyManager;
MyCurrencyManager = (CurrencyManager)BindingContext[this.dgGrid.DataSource, this.dgGrid.DataMember] ;
((DataRowView)(MyCurrencyManager.Current)).Row.Delete() ;