Results 1 to 2 of 2

Thread: [RESOLVED] Sort Datagridview by multiple columns?

  1. #1

    Thread Starter
    Addicted Member tgf-47's Avatar
    Join Date
    Feb 2010
    Location
    CapeTown, South Africa -34.01244,18.337415
    Posts
    209

    Resolved [RESOLVED] Sort Datagridview by multiple columns?

    How do I sort a DGV by multiple columns. I've seen a few discussions on the topping while searching google, but I don't understand what is going on.

    Plz help me

  2. #2
    Master Of Orion ForumAccount's Avatar
    Join Date
    Jan 2009
    Location
    Canada
    Posts
    2,802

    Re: Sort Datagridview by multiple columns?

    Code:
    Dim table = New DataTable()
    table.Columns.Add("Letter", GetType(Char))
    table.Columns.Add("Number", GetType(Integer))
    
    table.Rows.Add("A"c, 1)
    table.Rows.Add("B"c, 3)
    table.Rows.Add("A"c, 3)
    table.Rows.Add("A"c, 2)
    table.Rows.Add("B"c, 2)
    table.Rows.Add("B"c, 1)
    
    '//apply sort on Letter, then Number column
    table.DefaultView.Sort = "Letter, Number"
    
    Me.DataGridView1.DataSource = table

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width