Did you see when you double-click over the "border" of the columnheader that its width changes to fit all the info in it? Is there any way to programmatically do this?
Printable View
Did you see when you double-click over the "border" of the columnheader that its width changes to fit all the info in it? Is there any way to programmatically do this?
Once again, wish I could take credit.....but I cant...
I found this, when I was attempting the same sort of thing....
works great!
Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
lparam As Any) As Long
Public Const LVM_FIRST = &H1000
Public Const LVM_SETCOLUMNWIDTH = (LVM_FIRST + 30)
Public Const LVSCW_AUTOSIZE_USEHEADER As Long = -2
---------------------------------------------
With ListView1
colCnt = .ColumnHeaders.Count
ReDim myCols(colCnt)
intCol = 0
For i = 1 To colCnt
Call SendMessage(ListView1.hwnd, LVM_SETCOLUMNWIDTH, intCol, ByVal LVSCW_AUTOSIZE_USEHEADER)
intCol = intCol + 1
Next i
End With
--------------------------
Put the with right after I populated the listview.....and it takes care of everything at one time.....
Hope it helps!
It does, indeed!! Thank you very much!!Quote:
Originally posted by VB4fun
...works great!....
Perfect! Thanks!