Click to See Complete Forum and Search --> : saving listitems after sorting...


Creamy pie
June 5th, 2000, 02:52 PM
I want to save the listview items before closing. When I sort a column and close the listview, the sort order must be saved. How is this possible?

thanks

Johnny101
June 5th, 2000, 04:39 PM
Sounds like a registry entry to me. You could use code similiar to the following to set this value:


Sub SaveLVSettings()
If SaveSetting(app.exename,me.name,"ListViewSortStyle",ListView1.SortKey) then
'it saved - do nothing
else
msgbox "Settings could not be saved.",vbinformation
End if
End Sub





then when the form opens up, you can read that value back in :

private Sub Form_Load()
ListView1.SortKey = CInt(GetSettings(app.exename,me.name,"ListViewSortStyle","0"))
End Sub




this will place a registry setting in the CurrentUser\Software\VB and VBA Program Settings\(Your AppName) hive.

hope this helps,

John


John Pirkey
MCSD
http://www.ShallowWaterSystems.com
http://www.stlvbug.org