Results 1 to 2 of 2

Thread: win form 2003 Datagrid column sort on load

  1. #1
    Join Date
    Mar 2006
    Posts
    35

    Default win form 2003 Datagrid column sort on load

    hello,

    I need to sort a specific column of a datagrid in descending order on the form load event of a windows form

    doing the sort in the sql query is not an option as my company is using visual developer and i don't have access to the query.

    Does any one have any suggestion?

    thank you

  2. #2
    Join Date
    Mar 2006
    Posts
    35

    Default found some code that will work

    Dim mydv As DataView = New DataView
    Dim columnname As String = Datagrid.TableStyles(0).GridColumnStyles(specificC olumnToSort).MappingName
    Dim mydt As DataTable = New DataTable
    mydt = Datagrid.DataSource
    mydv = mydt.DefaultView
    mydv.Sort = columnname + " DESC"

Posting Permissions

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