for (int i = 0; i < dgvDemo.Columns.Count; i++) dgvDemo.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;