Okay, This is Confusing
Whilst the application is running it can save and load settings. Once its closed and reopened it sets back to defaults?!?
Form Load - Code:
if Preferences.integer("FontSize") = 0 then
SetPreferences()
else
GetPreferences()
end if
Module Code (For Setting and Getting Preferences)
Sub SetPreferences()
Preferences.SetString("FontName", "Arial")
Preferences.SetInteger("FontSize", 10)
Preferences.SetBoolean("FontBold", False)
Preferences.SetBoolean("FontItalic", False)
Preferences.SetBoolean("FontUnderline", False)
Preferences.SetString("TagColor", "&H00557F")
Preferences.SetString("CommentColor", "&HAAAA7F")
Preferences.SetString("CommandColor", "&HFFAA00")
Preferences.SetBoolean("AutoCheck", False)
End Sub
Sub GetPreferences()
FMain.rtfBox.FontName= Preferences.String("FontName")
FMain.rtfBox.FontSize = Preferences.Integer("FontSize")
FMain.rtfBox.FontBold= Preferences.Boolean("FontBold")
FMain.rtfBox.FontItalic= Preferences.Boolean("FontItalic")
FMain.rtfBox.FontUnderline= Preferences.Boolean("FontUnderline")
FMain.rtfBox.KeywordColor = Preferences.String("CommandColor")
FMain.rtfBox.CommandColor = Preferences.String("TagColor")
FMain.rtfBox.CommentColor = Preferences.String("CommentColor")
if Preferences.Boolean("AutoCheck") = True then
Dim UptodateVersion as string = Application.LoadURLAsString("elgunvo.de/Codie/version.ini")
dim MyVersion As String = Mid(Application.LoadProjectFileAsString("version.ini"), 0,5)
if MyVersion <> UpToDateVersion then
dim n as integer = msgbox ("Version " & UpToDateVersion & " is now available, please download it.", kbYesNo, "Update Message")
if n=6 then
Application.LoadExternalBrowserWithHTML("http://elgunvosoftware.com")
End if
End If
End If
End Sub
Settings Form- Code:
Private Sub Form_OnOpen()
lblFN.caption= Preferences.String("FontName")
lblFS.caption= Preferences.Integer("FontSize")
chkB.value= Preferences.Boolean("FontBold")
chkI.value= Preferences.Boolean("FontItalic")
chkU.value= Preferences.Boolean("FontUnderline")
txtKeyColor.text= Preferences.String("CommandColor")
txtTagColor.text= Preferences.String("TagColor")
txtCommentColor.text= Preferences.String("CommentColor")
chkUpdate.value = Preferences.Boolean("AutoCheck")
End Sub
Private Sub CommandButton5_OnEvent()
Preferences.SetString("FontName", lblFN.caption)
Preferences.SetInteger("FontSize", CInt(lblFS.caption))
Preferences.SetBoolean("FontBold", chkB.value)
Preferences.SetBoolean("FontItalic", chkI.value)
Preferences.SetBoolean("FontUnderline", chkU.value)
Preferences.SetString("TagColor", txtTagColor.text)
Preferences.SetString("CommentColor", txtCommentColor.text)
Preferences.SetString("CommandColor", txtKeyColor.text)
Preferences.SetBoolean("AutoCheck", chkUpdate.value)
GetPreferences()
me.close
End Sub
Why does it reset after relaunch... none of the settings save?!?