If you're using an INI File Format you'd be better off using the GetPrivateProfileString API which is specificly for retrieving data from an INI File, eg.
Where MyINI.ini is the Name of your INI File.Code: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 Command1_Click() Dim sBuff As String * 255 Call GetPrivateProfileString("PROGRAM NAME", "Total_Fields", "", ByVal sBuff, 255, "C:\MyINI.ini") If Left(sBuff, 1) <> Chr(0) Then MsgBox Left(sBuff, InStr(sBuff, Chr(0)) - 1) End Sub
------------------
Aaron Young
Analyst Programmer
[email protected]
[email protected]




Reply With Quote