点击DataGridView的Head,DataGridView中的数据会自动升序或降序重新排列.怎么屏蔽掉?谢谢!

解决方案 »

  1.   

    DataGridView.AllowUserToOrderColumns = false
      

  2.   

    DataGridView.AllowUserToOrderColumns = false已经写了,也没用啊,点击照样重新排序
      

  3.   

    我试了,可以呀。在列编辑里把它设为NotSortable
      

  4.   

    foreach (DataGridViewColumn dc in DataGridView.Columns)
                {
                    dc.SortMode = DataGridViewColumnSortMode.NotSortable;
                }