Evo. Mislim da jednostavnije za upotrebu ne moze. Nije bas u uobicajenom formatu .ini fajla ali radi. Ako hoces promeni ekstenziju fajla. Naravno ti prilagodi ovo svojoj aplikaciji i stavi svoja imena check-ova i putanju i ime fajla.
Znaci, kad hoces da sacuvas stanje pozivas funkciju WriteSets a kad hoces da ucitas ReadSets.
Code:
Private Sub WriteSets()
Dim fso As New FileSystemObject
Dim MyStream As TextStream
Dim strSettings As String
Set MyStream = fso.OpenTextFile("c:\Setts.ini", ForWriting, True)
strSettings = Check1.Value & Check2.Value & Check3.Value & _
Check4.Value & Check5.Value & Check6.Value & _
Check7.Value & Check8.Value & Check9.Value & _
Check10.Value & Check11.Value & Check12.Value & _
Check13.Value
MyStream.WriteLine (strSettings)
MyStream.Close
End Sub
Private Sub ReadSets()
Dim fso As New FileSystemObject
Dim MyStream As TextStream
Dim strSettings As String
Set MyStream = fso.OpenTextFile("c:\Setts.ini", ForReading, True)
strSettings = MyStream.ReadLine
MyStream.Close
Check1.Value = Mid(strSettings, 1, 1)
Check2.Value = Mid(strSettings, 2, 1)
Check3.Value = Mid(strSettings, 3, 1)
Check4.Value = Mid(strSettings, 4, 1)
Check5.Value = Mid(strSettings, 5, 1)
Check6.Value = Mid(strSettings, 6, 1)
Check7.Value = Mid(strSettings, 7, 1)
Check8.Value = Mid(strSettings, 8, 1)
Check9.Value = Mid(strSettings, 9, 1)
Check10.Value = Mid(strSettings, 10, 1)
Check11.Value = Mid(strSettings, 11, 1)
Check12.Value = Mid(strSettings, 12, 1)
Check13.Value = Mid(strSettings, 13, 1)
End Sub