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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top