Reading the INI file in .NET is consistent, the only note is that the LONG type variable in the API declaration is changed to the int32 type in .NET
Private 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 Int32, ByVal lpFileName As String) As Int32 Private Declare Function WritePrivateProfileString Lib "kernel32" "WritePrivateProfileStringa" (byval lpapplicationname as string, byval lpstring as string, byval lpfilename as string) AS INT32
Private Sub Button1_Click (ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim strIni As String strIni = New String ( "", 100) GetPrivateProfileString ( "AppName", "KeyA", "", strIni , 100, "c: /a.ini") WritePrivateProfileString ("Appname", "Keyb", "MyValue", "c: /a.ini") MSGBOX (STRINI) End Sub
This code is debugged in .NET WIN2000