Sequential Item No on a ListBox

Hi All,

I have a desktop ListBox and I would like to assign an item sequence at column 0. If the user sorts on any column, the item sequence should reset, i.e. the sequence should be in sequential order no matter the order of the ListBox is. I tried to trigger a method in the SortColumn eventhandler, but it seems to trigger my method before finish the sorting. Please help.

What about the even HeaderPressed?

Not working either

Can you post some of your code or an example? Which os do you use? Does your data live in the listbox or do you load the data from somewhere?

// Add sequence to column 0
Function CellTextPaint(g As Graphics, row As Integer, column As Integer, x as Integer, y as Integer) Handles CellTextPaint as Boolean
dim v as integer = row + 1
me.Cell(row,0) = v.ToText
me.CellAlignment(row,0) = Listbox.AlignRight
End Function

// Disable Sort column 0
Function SortColumn(column As Integer) Handles SortColumn as Boolean
if column = 0 then
return true
else
return false
end if
End Function

If your ListBox has 3 columns, use this to add values to the ListBox:
me.AddRow("","Server " + i.ToText,"Some Text " + i.ToText)

Thanks Horst