我需要禁用列标题中的DataGridView
排序。
I need to disable the column header sorting in DataGridView
.
我们可以做到这一点通过设置各列的属性如
We can do that by setting the property of individual columns like
BalancesGridView.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable;
如果是这样的话,那么我会在所有的列具有循环。
If this is the case , then I'll have to loop through all the columns.
有没有更好的办法?
没有,我想设置在列的SortMode直接是因为它得到很好的。但说实话,谁在乎呢?这有什么不好一个简单的循环?
No, I think setting the SortMode on the column directly is as good as it gets. But honestly, who cares? What's so bad about a simple loop?