[RESOLVED] vb6 to .NET (GetPrivateProfileStringKey, ini files)
Anyone have any idea why this works in VB6, but not in VB.NET?
I can use the WriteProfileString without any problems (after changing the As Any to As String), but I can't get it to read the .ini file.
-----------
Private Declare Function GetPrivateProfileStringKey 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
Public Sub LoadDefaults()
Dim sValue As String ' server
Dim s As Integer
Dim sSize As Integer
sValue = " " '50 spaces
sSize = 50
Dim iFile As String
iFile = Application.StartupPath & "\" & Application.ProductName & ".ini"
'server
s = GetPrivateProfileStringKey("Settings", "Server", "sd-web", sValue, sSize, iFile)
tbServer.Text = sValue
End Sub
------------
thanks,