darkstrike20
Member
- Joined
- Jul 17, 2014
- Messages
- 7
- Programming Experience
- Beginner
I'm having problem at the specified **** row for write INI function, please help me to see whether it's the data type declared wrongly or my function written wrongly.
**Declaration for write profile string with 4 parameters
<DllImport("kernel32.dll")> _
Public Function WriteProfileString(ByVal lpAppName As String, ByVal lpKeyName As String, ByVal lpString As String, ByVal filename As String) As Boolean
End Function
**Declaration for write profile string with 3 parameters
<DllImport("kernel32.dll")> _
Public Function WriteProfileString(ByVal lpAppName As String, ByVal lpKeyName As String, ByVal lpString As String) As Boolean
End Function
**Function for WriteINI
Public Function WriteINI(ByVal filename As String, ByVal section As String, ByVal key As String, ByVal sValue As String) As Boolean
Dim bRslt As Boolean
If filename = "" Then
bRslt = WriteProfileString(section, key, sValue)
Else
**** This is where the problem occur
bRslt = WriteProfileString(section, key, sValue, filename)
End If
Return bRslt
End Function
Public Function WriteINI(ByVal section As String, ByVal key As String, ByVal sValue As String) As Boolean
Return WriteINI(section, key, sValue)
End Function
*** These lines called the method
WriteINI("GENERALSETUP", "ServerName", SqlServerName.Text, App_Path & "\GSetup.ini")
WriteINI("GENERALSETUP", "UserID", "" & DefLoginName & "", App_Path & "\GSetup.ini")
WriteINI("GENERALSETUP", "Password", TEncrypt("SERVERLOGIN" & DefPassword), App_Path & "\GSetup.ini")
**Declaration for write profile string with 4 parameters
<DllImport("kernel32.dll")> _
Public Function WriteProfileString(ByVal lpAppName As String, ByVal lpKeyName As String, ByVal lpString As String, ByVal filename As String) As Boolean
End Function
**Declaration for write profile string with 3 parameters
<DllImport("kernel32.dll")> _
Public Function WriteProfileString(ByVal lpAppName As String, ByVal lpKeyName As String, ByVal lpString As String) As Boolean
End Function
**Function for WriteINI
Public Function WriteINI(ByVal filename As String, ByVal section As String, ByVal key As String, ByVal sValue As String) As Boolean
Dim bRslt As Boolean
If filename = "" Then
bRslt = WriteProfileString(section, key, sValue)
Else
**** This is where the problem occur
bRslt = WriteProfileString(section, key, sValue, filename)
End If
Return bRslt
End Function
Public Function WriteINI(ByVal section As String, ByVal key As String, ByVal sValue As String) As Boolean
Return WriteINI(section, key, sValue)
End Function
*** These lines called the method
WriteINI("GENERALSETUP", "ServerName", SqlServerName.Text, App_Path & "\GSetup.ini")
WriteINI("GENERALSETUP", "UserID", "" & DefLoginName & "", App_Path & "\GSetup.ini")
WriteINI("GENERALSETUP", "Password", TEncrypt("SERVERLOGIN" & DefPassword), App_Path & "\GSetup.ini")