How can I disable sorting in a DatagridView?

  • Thread starter Bruno Neves Pires Silva
  • Start date
B

Bruno Neves Pires Silva

Hello, Programmers.

How can I disable sorting in a DatagridView?

Thanks in advance.
 
B

Bruno Neves Pires Silva

Hello, Programmers.

How can I disable sorting in a DatagridView?

Thanks in advance.

I have found out:
by the property sortmode of each column.
Thanx.
 
M

Marc Gravell

On each column, set the SortMode to NotSortable or Programmatic; either via
the IDE, or via a simple loop:

foreach (DataGridViewColumn column in grid.Columns)
{
column.SortMode = DataGridViewColumnSortMode.NotSortable;
}

Marc
 
C

Ciaran O''Donnell

Hows this:

DataGridView gridView;
foreach (DataGridViewColumn column in gridView.Columns)
{
column.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

Top