private void dataGridView_CellClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex == -1) { sorting = true; } }