prova così:
codice:
Imports System
Imports System.IO
Imports System.Runtime.InteropServices
Imports System.Text
Namespace Ini
Public Class IniFile
Private ReadOnly _path As String
Public ReadOnly Property path() As String
Get
Return Me._path
End Get
End Property
<DllImport("kernel32")> _
Private Shared Function WritePrivateProfileString(ByVal section As String, ByVal key As String, ByVal val As String, ByVal filePath As String) As Long
End Function
<DllImport("kernel32")> _
Private Shared Function GetPrivateProfileString(ByVal section As String, ByVal key As String, ByVal def As String, ByVal retVal As StringBuilder, ByVal size As Integer, ByVal filePath As String) As Integer
End Function
Public Sub New(ByVal INIPath As String)
Me._path = INIPath
End Sub
Public Sub IniWriteValue(ByVal Section As String, ByVal Key As String, ByVal Value As String)
WritePrivateProfileString(Section, Key, Value, Me.path)
End Sub
Public Function IniReadValue(ByVal Section As String, ByVal Key As String) As String
Dim temp As New StringBuilder(255)
Dim i As Integer = GetPrivateProfileString(Section, Key, "", temp, 255, Me.path)
Return temp.ToString()
End Function
End Class
End Namespace