PDA

View Full Version : win form 2003 Datagrid column sort on load



woodsprite
May 25, 2006, 04:37 PM
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 :eusa_wall

woodsprite
May 25, 2006, 05:06 PM
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"