I'm makeing a small program that edits an ini file, it works but the problem is that the ini file that I am editing's titles are formated like this: [ title ] unless I manualy chainge them to: [title] it doesn't work.
I have tryed: lpappname = " title " but it still doesn't work unless the format in the ini is [title]
the program will only retrive information from the ini file if the titles in the ini are writen like this: [title] if they are writen as [ title ] I get an error mesage e.g.
I have maualy edited it but I'm planning to distribute the program and I couldn't expect everyone else to do that. How could I use plain VB code to do the Same thing without over complicateing things?
If you are using VB6, you could use the REPLACE function to format these spaces :
Code:
Dim StrFile as String
StrFile = "C:\Name_Of_File.ini"
Replace "[ ", StrFile, "["
Replace " ]", StrFile, "]"
This will only work if there's one space between the bracket & the word, and I am 99% sure that this is only for VB6. But, it might be able to help you, use the above before you retrieve the ini file information.
Please rate this post if it was useful for you!
Please try to search before creating a new post,
Please format code using [ code ][ /code ], and
Post sample code, error details & problem details
I can't seem to get that module working, could you post some sample code?
this is the module I was useing:
Code:
Public Declare Function WritePrivateProfileString _
Lib "kernel32" Alias "WritePrivateProfileStringA" _
(ByVal lpApplicationname As String, _
ByVal lpKeyName As Any, _
ByVal lsString As Any, _
ByVal lplFilename As String) As Long
Public Declare Function GetPrivateProfileInt _
Lib "kernel32" Alias "GetPriviteProfileIntA" _
(ByVal lpApplicationname As String, _
ByVal lpKeyName As String, _
ByVal nDefault As Long, _
ByVal lpFileName As String) As Long
Public Declare Function GetPrivateProfileString _
Lib "kernel32" Alias "GetPrivateProfileStringA" _
(ByVal lpApplicationname As String, _
ByVal lpKeyName As String, _
ByVal lpDefault As String, _
ByVal lpReturnedString As String, _
ByVal nSize As Long, _
ByVal lpFileName As String) As Long