|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
How do i read and write ini file using vb.net?"TBoon" <allblack***@hotmail.com> schrieb: Storing and loading user preferences> How do i read and write ini file using vb.net? <URL:http://dotnet.mvps.org/dotnet/faqs/?id=userpreferences&lang=en> -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://dotnet.mvps.org/dotnet/faqs/> xml is a better way to go in my humble opinion.
http://www.kjmsolutions.com/xmlsettings.htm Show quoteHide quote "TBoon" <allblack***@hotmail.com> wrote in message news:OKbPIJSJHHA.3552@TK2MSFTNGP03.phx.gbl... > How do i read and write ini file using vb.net? > If you are looking for the legacy approach... (pinvoke.net is a nice site
for finding these sorts of things). Class Util Public Shared Function readINI(ByVal sSection As String, ByVal sKey As String, ByVal sFile As String) As String Dim sb As StringBuilder Dim iRet As Integer sb = New StringBuilder(500) iRet = WinApi.GetPrivateProfileString(sSection, sKey, "", sb, sb.Capacity, sFile) Return sb.ToString End Function Public Shared Sub writeINI(ByVal sSection As String, ByVal sKey As String, ByVal sFile As String, ByVal sValue As String) Dim bOk As Boolean bOk = WinApi.WritePrivateProfileString(sSection, sKey, sValue, sFile) End Sub end class Class WinApi <DllImport("kernel32.dll", SetLastError:=True)> _ Public Shared Function GetPrivateProfileString(ByVal lpAppName As String, _ ByVal lpKeyName As String, _ ByVal lpDefault As String, _ ByVal lpReturnedString As StringBuilder, _ ByVal nSize As Integer, _ ByVal lpFileName As String) As Integer End Function <DllImport("kernel32.dll", SetLastError:=True)> _ Public Shared Function WritePrivateProfileString(ByVal lpAppName As String, _ ByVal lpKeyName As String, _ ByVal lpString As String, _ ByVal lpFileName As String) As Boolean End Function End Class Show quoteHide quote "TBoon" <allblack***@hotmail.com> wrote in message news:OKbPIJSJHHA.3552@TK2MSFTNGP03.phx.gbl... > How do i read and write ini file using vb.net? > |
|||||||||||||||||||||||