I have a checkedlistbox control on my form and it saves the items in the list with the code below, but it does not save if they have been checked.. so I would like it to remember if they were checked, that way when it loads the items back into the listbox it will have them checked.
Save code:
Load code:
Save code:
Visual Basic:
'Saves Misc Goals
Dim Miscfs As New System.IO.FileStream(Application.StartupPath & "\MiscGoals.dat", System.IO.FileMode.Create)
Dim Miscsw As New System.IO.StreamWriter(Miscfs)
Dim obj As Object
For Each obj In listboxMiscGoals.Items
Miscsw.WriteLine(obj.ToString())
Next obj
Miscsw.Close()
Load code:
Visual Basic:
'Loads Misc Goals into listbox
Dim Miscfs As New System.IO.FileStream(Application.StartupPath & "\MiscGoals.dat", System.IO.FileMode.Open)
Dim Miscsr As New System.IO.StreamReader(Miscfs)
Dim Miscline As String
Do
Miscline = Miscsr.ReadLine
If Miscline Is Nothing Then
Exit Do
Else
listboxMiscGoals.Items.Add(Miscline)
End If
Loop
Miscsr.Close()