Save settings to file



Hi,

I need helt regarding settings I want to save to an INI-file.
I got a function wich allows me to read settings from the INI-file when the
application starts up. But I want to save a few settings into the INI-file
at some time, like when the appl is exited.

See below the function for reading the seetings. But how do I write to same
spot in the INI-file the settings I need to save?
Do I need another function for save seetings? And how will I be sure that I
really update correct fields in my INI-file?

Can someone please help.

Thanx.


'FUNCTION FOR READING FROM THE INI-FILE
Private Function GetIniSetting(ByVal header As String, ByVal Item As String)
As String
Dim Rets As String
Dim i As Integer

Rets = Space$(200)
i = GetPrivateProfileString(header, Item, " ", Rets, Len(Rets), PROF_FILE)
Rets = Trim$(Rets)
If (Len(Rets) > 1) Then
GetIniSetting = Left$(Rets, Len(Rets) - 1)
Else
GetIniSetting = ""
End If

End Function

'AND SOME OF THE SEETING ARE UPLOADED AT START-UP
Private Sub Form_Load()

lstSentLog.Clear

'LÄSER IN INSTÄLLNINGAR FRÅN INI-FIL
LogPath = GetIniSetting("PATHS", "LOGGPATH")
Label1.Caption = "Logpath: " & LogPath
gbRunLog = (GetIniSetting("LOG", "LOGGNING") = "Ja")
Label2.Caption = "Loggning aktiv: " & gbRunLog

intAntCC2 = GetIniSetting("AntalTel", "CC2")
intAntBT1 = GetIniSetting("AntalTel", "BT1")
' intAntPL = GetIniSetting("AntalTel", "PL")

Call LaddaText
Call LaddaTel
LogToPrioWindow (Now & " Form load utförd")

Node = "FIX"
Field = "F_CV"
End Sub

--


//Kashif

*******
The brain is a wonderful organ; it starts working the moment you get up in
the morning and does not stop until you get to the office
*******


.