DataGridView column sort

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

All,

..Net 2.0 DataGridView column sort is automatic, I don't want column sort, is
anybody know how to not sort column in DataGridView?

Thanks
 
Hi, Cor,

when using following code to disable column sort and get "Object reference
not set to an instance of an object" error message, it is NullReference
Exception, the dataGridView1 is already created by draging the datagrid onto
the form, can you help this out? Thanks

DataGridView1.SortedColumn.SortMode = DataGridViewColumnSortMode.NotSortable
 
use column_name like below works

DataGridView.Columns("column_name").SortMode =
DataGridViewColumnSortMode.NotSortable
 
Back
Top