Can't resize based on column header width...

I wrote a routine to adjust the widths of a listbox to the contents…
i.e. Each column is made wide enough to show the entire contents of the columns cells, based on the largest cell… be it the header title or the cell contents.
However it just doesn’t seem to count the Column header and I can’t figure out why!
P.S. If the column title is : then it is an invisible column…

[code]Sub AdjustColumnWidths(Extends lb as Listbox)
dim r,c as Integer
dim pic as new Picture(1,1,32)
dim g as graphics = pic.Graphics
dim w as integer
dim colmax as integer
dim cw as string = “”
dim colmin as integer = 25
dim rows, cols as integer
dim cc as string

rows = lb.ListCount-1
cols = lb.ColumnCount-1

g.TextFont = lb.TextFont
g.TextSize = lb.TextSize

for c=0 to cols-1 'The last column occupies the remaining space. *
if lb.Heading© = “:” then
colmax = 0
colmax = g.StringWidth(lb.Heading©)
for r=0 to rows
cc = lb.Cell(r,c)
w = g.StringWidth(cc)
if w > colmax then colmax = w
next r
if colmax < colmin then colmax = colmin
end if
if colmax <> 0 then
cw = cw + str(colmax+8) + “,”
cw = cw + “0,”
end if
next c
cw = left(cw, len(cw)-1) 'trim the extra , *

if lb.sortedColumn > -1 then // the listbox is sorted by a column
if lb.LastIndex > 0 then
lb.sort// sort the listbox data using the current sort settings
end if
lb.ColumnWidths = cw

End Sub