Hi,
The code below to save the settings for my program.
vb Code:
Option Explicit
Private Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" _
(ByVal lpApplicationName As String, _
ByVal lpKeyName As Any, _
ByVal lpString As Any, _
ByVal lpFileName As String) As Long
Private Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" _
(ByVal lpApplicationName As String, _
ByVal lpKeyName As Any, _
ByVal lpDefault As String, _
ByVal lpReturnedString As String, _
ByVal nSize As Long, _
ByVal lpFileName As String) As Long
Public settings As String, lngReturn As Long
Private startup As String
Public Sub WriteINI()
startup = frmMain.chkStartup.Value
settings = App.Path & "\settings.ini"
lngReturn = WritePrivateProfileString("Load", "Startup", startup, settings)
End Sub
Public Function ReadINI()
Dim strSection As String
Dim strKey As String
Dim strValue As String
Dim strDefault As String
Dim strFile As String
Dim lngLength As Long
lngReturn = GetPrivateProfileString(strSection, _
strKey, _
strDefault, _
strValue, _
lngLength, _
strFile)
If FileExists(settings) Then frmMain.chkStartup.Value = lngReturn
End Function
Saving the data into the files work just not the input although, there is no error the value does not get sent to the check box.
Thanks,
Nightwalker