How can I disable sorting in a DatagridView?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bruno Neves Pires Silva

    How can I disable sorting in a DatagridView?

    Hello, Programmers.

    How can I disable sorting in a DatagridView?

    Thanks in advance.
  • Bruno Neves Pires Silva

    #2
    Re: How can I disable sorting in a DatagridView?

    On 10 jul, 11:06, Bruno Neves Pires Silva <brunonpsi...@g mail.com>
    wrote:
    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.

    Comment

    • Marc Gravell

      #3
      Re: How can I disable sorting in a DatagridView?

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

      foreach (DataGridViewCo lumn column in grid.Columns)
      {
      column.SortMode = DataGridViewCol umnSortMode.Not Sortable;
      }

      Marc


      Comment

      • =?Utf-8?B?Q2lhcmFuIE8nJ0Rvbm5lbGw=?=

        #4
        RE: How can I disable sorting in a DatagridView?

        Hows this:

        DataGridView gridView;
        foreach (DataGridViewCo lumn column in gridView.Column s)
        {
        column.SortMode = DataGridViewCol umnSortMode.Not Sortable;
        }

        --
        Ciaran O''Donnell
        try{ Life(); } catch (TooDifficultException) { throw Toys(); }



        "Bruno Neves Pires Silva" wrote:
        Hello, Programmers.
        >
        How can I disable sorting in a DatagridView?
        >
        Thanks in advance.
        >

        Comment

        Working...