CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2000
    Posts
    175

    saving listitems after sorting...

    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


  2. #2
    Join Date
    Jan 2000
    Location
    MO, USA
    Posts
    1,506

    Re: saving listitems after sorting...

    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
    John Pirkey
    MCSD (VB6)
    http://www.stlvbug.org

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured