Hey guys,
I've a lil question.
At the moment i write my needed setting in a simple textfile one beneath the other, but there are more and more settings i need to save.
So I m asking whether it is posible to create a structured text file and write the settings at predefined places.
the code I am using right now is:
best regards
Sascha
I've a lil question.
At the moment i write my needed setting in a simple textfile one beneath the other, but there are more and more settings i need to save.
So I m asking whether it is posible to create a structured text file and write the settings at predefined places.
the code I am using right now is:
Code:
Public Function SaveLoadSettings (SaveLoad As String,FilePath As String,LastModule As String, GeneralSettings()As Double)As String()
Dim i As Integer
Dim SettingPath As String
Dim SettingsText As String
Dim iFileNo As Integer
Dim TmpArray(10) As String
i=0
SettingPath = "C:\Conf Test-Automation\Settings\Settings.ini"
'Save Settings
If SaveLoad = "Save" Then
iFileNo = FreeFile
'open file for writing
'if this file already exists it will be overwritten!
Open SettingPath For Output As #iFileNo
'write Settings delete Settings(Print #iFileNo,"")
Print #iFileNo, FilePath
Print #iFileNo, LastModule
Print #iFileNo, CStr(GeneralSettings(0)*100)
Print #iFileNo, CStr(GeneralSettings(1)*100)
Print #iFileNo, CStr(GeneralSettings(2)*1000)
Print #iFileNo, CStr(GeneralSettings(3)*1000)
Print #iFileNo, CStr(GeneralSettings(4)*1000)
Print #iFileNo, CStr(GeneralSettings(5)*100)
Print #iFileNo, CStr(GeneralSettings(6)*100)
Print #iFileNo, CStr(GeneralSettings(7))
Print #iFileNo, CStr(GeneralSettings(8)*1000)
'close the file, otherwise the File can't be reopened
Close #iFileNo
'Load Settings
Else
iFileNo = FreeFile
'open the file for reading
Open SettingPath For Input As #iFileNo
'read the file until EOF(End of File)
Do While Not EOF(iFileNo)
Line Input #iFileNo, SettingsText
TmpArray(i) = SettingsText
i=i+1
Loop
'close the file, otherwise the File can't be reopened
Close #iFileNo
End If
SaveLoadSettings = TmpArray
End Function
Sascha