private void GRID_MouseUp(object sender, MouseEventArgs e) { if (sender == null) return; if (!typeof(DataGrid).IsAssignableFrom(sender.GetType())) return; DataSet D = DetailGrid.DataSource as DataSet; if (D == null) return; DataTable T = D.Tables[DetailGrid.DataMember]; if (T == null) return; System.Windows.Forms.DataGrid.HitTestInfo myHitTest = DetailGrid.HitTest(e.X, e.Y); if (myHitTest.Type == System.Windows.Forms.DataGrid.HitTestType.Cell) { int Row = myHitTest.Row; if (!DetailGrid.IsSelected(Row)) { SimpleSelect(Row); } else { DetailGrid.UnSelect(Row); } } else { int Row = myHitTest.Row; } }