If you want to use a True INI File, then you need to use the GetPrivateProfileString and WritePrivateProfileString API's, eg.
Code: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 Private Sub Form_Load() Dim sBuff As String * 255 'Load the Caption from the INI File. Call GetPrivateProfileString(App.Title, "Caption", "Default Caption", sBuff, 255, "C:\Caption.ini") Caption = Left(sBuff, InStr(sBuff, Chr(0)) - 1) Text1 = Caption End Sub Private Sub Form_Unload(Cancel As Integer) 'Save the New Caption to the INI File. Call WritePrivateProfileString(App.Title, "Caption", ByVal Text1.Text, "C:\Caption.ini") End Sub
------------------
Aaron Young
Analyst Programmer
[email protected]
[email protected]




Reply With Quote