PDA

Click to See Complete Forum and Search --> : ListView Save settings


dmach8
Jan 13th, 2000, 08:02 AM
With a multi columned listview shown as a listreport is there a way to save the size of the columns, (after the user as adjusted them to their liking) to the registry so when the program is reopened they won't have to set them again? Thanks in advance

Joacim Andersson
Jan 13th, 2000, 03:14 PM
Sure, here's an example:

Private Const DEFAULT_WIDTH = 500 'or whatever you prefer

Private Sub Form_Load()
Dim iCount%, i%
With ListView1
iCount = .ColumnHeaders.Count
For i = 1 To iCount
.ColumnHeaders(i).Width = GetSetting("YourAppName", "SectionName", "Column" & i, DEFAULT_WIDTH)
Next
End With
End Sub

Private Sub Form_Unload(Cancel As Integer)
Dim iCount%, i%
With ListView1
iCount = .ColumnHeaders.Count
For i = 1 To iCount
SaveSetting "YourAppName", "SectionName", "Column" & i, .ColumnHeaders(i).Width
Next
End With
End Sub

Good luck!

------------------
Joacim Andersson
joacim@programmer.net
joacim@yellowblazer.com
www.YellowBlazer.com (http://www.YellowBlazer.com)