Results 1 to 4 of 4

Thread: [RESOLVED] Saving and loading settings of listbox checkstyle?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jan 2007
    Posts
    93

    Resolved [RESOLVED] Saving and loading settings of listbox checkstyle?

    Hi, i am wondering how to save and load settings in a listbox with checkbox style. I want to have it so the user can click a button "save setting" and the list is stored and the selected checkboxes for the list are stored, so when the user starts the program again, the click "load setting" and the list and checked boxs are loaded.
    Last edited by Hack; Feb 13th, 2007 at 10:57 AM. Reason: Added [RESOLVED] to thread title and green "resolved" checkmark

  2. #2
    Frenzied Member
    Join Date
    Jun 2006
    Posts
    1,098

    Re: Saving and loading settings of listbox checkstyle?

    You would need to write the information to a file.
    VB Code:
    1. Private Sub cmdLoadList_Click()
    2.   Dim strItem As String
    3.   Dim blnChecked As Boolean
    4.   Dim fnum As Integer
    5.  
    6.   On Error GoTo ErrHandler
    7.   fnum = FreeFile
    8.   Open App.Path & "\SavedList.txt" For Input As #fnum
    9.   List1.Clear
    10.   Do Until EOF(fnum)
    11.     Input #fnum, strItem, blnChecked
    12.     List1.AddItem strItem
    13.     List1.Selected(List1.NewIndex) = blnChecked
    14.   Loop
    15.   Close #fnum
    16.   Exit Sub
    17. ErrHandler:
    18.   If Err.Number = 53 Then
    19.     MsgBox "No saved list was found."
    20.   Else
    21.     MsgBox "Unhandle error: " & Err.Number
    22.   End If
    23. End Sub
    24.  
    25. Private Sub cmdSaveList_Click()
    26.   Dim fnum As Integer
    27.   Dim i As Long
    28.  
    29.   fnum = FreeFile
    30.   Open App.Path & "\SavedList.txt" For Output As #fnum
    31.   For i = 0 To List1.ListCount - 1
    32.     Write #fnum, List1.List(i); List1.Selected(i)
    33.   Next i
    34.   Close #1
    35. End Sub

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jan 2007
    Posts
    93

    Re: Saving and loading settings of listbox checkstyle?

    Thanks that works perfect. Sorry for taking so long, i got my new system! e6300, asus p5b-deluxe, 2x 1gb ocz gold xtc, 7600gt. Got a 16.434 seconds in superpi 1m at 500fsb on stock cooler! temps only hit 57 full load 4 hours.

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Saving and loading settings of listbox checkstyle?

    If you consider this resolved, would you please pull down the Thread Tools menu and click the Mark Thread Resolved menu item? That will let everyone know that you have your answer.

    Thank you.

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