I think outside of that you will need to add a column set it’s width to zero and then use that one so for a 3 column listbox where the 3rd has a width of zero
Function HeaderPressed As Boolean
If column = 1 then me.headingIndex = me.columncount -1
Oh this is a goofy one, I’ve got a snippet here I got from Dave a while back.
// No longer sorted, deselect col header.
me.SortedColumn = -1 // this clears the sorting internally
me.HasHeading = false // these two lines redraw the listbox header
me.HasHeading = true
Reading the list box docs about setting it to -1 might lead you to, I think quite reasonably, expect that there would be no column being sorted on hence no header that suggests there IS one.
Regarding the question which I have cited above, if you want to know how to have the lines in different colors, you can try doing this:
In your listbox, there is an event handler called CellBackgroundPaint. Do this:
If row < Listbox1.ListCount-1 Then
If row Mod 2 = 0 Then
g.ForeColor = RGB(255,0,0)
Else
g.ForeColor = RGB(0,0,255)
End If
g.FillRect 0,0,g.Width,g.Height
End If
You have to select your own colors if you don’t like those red and blue.
So, it may works before OR its my memory that is really bad. I recall (?) we had a solution sometimes ago, but due to a change (a deprecated instruction), it changed since. That is why I tested what I can and failed.
Now, at no time I was feeling that could be a bug or a miss !!!
Remove the Heading when asked to clear previous contents,
Set the Headings Back at data loading time.
This may look strange to the user (a flicker ?), but it achieve the trick:
no selected column at new data loading time
keep the data at the load time flow
at least, do not fool the user with a sorted column interface and no sorted data below.
Note: I’m typing this mail sitting in my car nears a free wifi hot spot (I’ve made a simple error: I goes out of my home one hour early (mistake while reading the hour ! And so I cannot test the suggestion(s).
;-
The two HasHeading lines alone does not do the trick (I just checked) and I suppose that SortedColumn = -1 does not do it too (I certainly tried that before asking for help here).