Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
嗨,我有一个 Datagridview,当用户单击列名时,我想让该网格不可排序。请帮忙。
您有 2 个选项:
通过DataGridView. 转到编辑列并将 SortMode 选项更改为 NotSortable。
DataGridView
通过代码。为要禁用排序的每一列编写此内容。
dataGridView1.Columns[ColumnNumber].SortMode = DataGridViewColumnSortMode.NotSortable;