protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { if (keyData == Keys.Escape) { if (_grid.BaseTable != null && _grid.Rows.Count < _grid.BaseTable.Rows.Count) { _grid.FilterClear(); return(true); } else { this.Close(); return(true); } } return(base.ProcessCmdKey(ref msg, keyData)); }