Hi,

The code below to save the settings for my program.

vb Code:
  1. Option Explicit
  2.  
  3. Private Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" _
  4.             (ByVal lpApplicationName As String, _
  5.              ByVal lpKeyName As Any, _
  6.              ByVal lpString As Any, _
  7.              ByVal lpFileName As String) As Long
  8. Private Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" _
  9.             (ByVal lpApplicationName As String, _
  10.              ByVal lpKeyName As Any, _
  11.              ByVal lpDefault As String, _
  12.              ByVal lpReturnedString As String, _
  13.              ByVal nSize As Long, _
  14.              ByVal lpFileName As String) As Long
  15. Public settings As String, lngReturn As Long
  16. Private startup As String
  17.  
  18. Public Sub WriteINI()
  19.   startup = frmMain.chkStartup.Value
  20.   settings = App.Path & "\settings.ini"
  21.   lngReturn = WritePrivateProfileString("Load", "Startup", startup, settings)
  22. End Sub
  23.  
  24. Public Function ReadINI()
  25. Dim strSection As String
  26. Dim strKey As String
  27. Dim strValue As String
  28. Dim strDefault As String
  29. Dim strFile As String
  30. Dim lngLength As Long
  31.    lngReturn = GetPrivateProfileString(strSection, _
  32.                                     strKey, _
  33.                                     strDefault, _
  34.                                     strValue, _
  35.                                     lngLength, _
  36.                                     strFile)
  37.     If FileExists(settings) Then frmMain.chkStartup.Value = lngReturn
  38. 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