|
-
Jul 29th, 2002, 01:07 PM
#1
[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,
-
Jul 29th, 2002, 01:14 PM
#2
api usage has changed some
http://www.devx.com/dotnet/discussio...cominterop.asp
but I would STRONGLY suggest learning and using XML instead as ini has been made obsolete by XML.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|