Thanks for your prompt response although I am having difficulty getting your proposed solution to work. I re-read my question and it probably didnt explain what I want to do very well so I want to try to explain it better.
So, when a user clicks a column, it is sorted in ascending order and a triange appears in the column header indicating that this is the column that the data is sorted by and which direction the data is sorted in. If they click the same header again, the direction toggles and the icon changes accordingly.
EXCEPT, when 'Subject' column 7 is clicked, we actually want to sort the grid by column 8 (hidden from view) BUT still want to display the direction icon in column 7 even though it is sorted by column 8.
I am only allowing the user to sort by one column at a time.
Here is the code that does the sorting correctly however when column 7 is clicked, no direction icon appears in that column (as I would expect it to).
Dim srt As iGrid470_10Tec.SortGroupObject
Dim lngOrder As Long
Set srt = grdMsg.SortObject
bDoDefault = False
If grdMsg.RowCount = 0 Then GoTo ExitPoint
'col 7: Subject (visible) << when this is clicked...
'col 8: conversation (hidden) << sort by this field BUT show the sort icon in col 7
If srt.SortCol(1) = lCol Or srt.SortCol(1) = 8 And lCol = 7 Then
If srt.SortOrder(1) = igSortAsc Then
lngOrder = igSortDesc
lngOrder = igSortAsc
If lCol = 7 Then
grdMsg.DoDefaultSort lCol + 1, Shift, lngOrder
grdMsg.DoDefaultSort lCol, Shift, lngOrder
So with this code if I select a column other than 7, it sorts by that column and shows the triangle icon that indicates the direction of the sort. If I click the same column again, it toggles the direction and the icon. Great!
If I click 'Subject' (column 7), the grid is sorted by the hidden column 8 (great) but no direction icon appears in the 'Subject' column heading.
So in this case I want to FORCE the triangle sort icon appear in column 7 even though it is sorted (correctly) by column 8.
Hope that makes sense.