Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

WriteProfileString (kernel32)
 
.
Summary

VB.NET Signature:

    <DllImport("kernel32.dll")> _
    Private Shared Function WriteProfileString(ByVal lpAppName As String, _
    ByVal lpKeyName As String, _
    ByVal lpString As String) As Boolean
    End Function

C# Signature:

[DllImport("kernel32.dll")]
static extern bool WriteProfileString(string lpAppName, string lpKeyName,
   string lpString);

User-Defined Types:

None.

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

VB.NET

    Public Function SetProfileString(ByVal filename As String, ByVal section As String, ByVal key As String, ByVal sValue As String) As Boolean
    Dim bRslt As Boolean
    If filename = "" Then
        bRslt = WriteProfileString(section, key, sValue)
    Else
        bRslt = WritePrivateProfileString(section, key, sValue, filename)
    End If
    Return bRslt
    End Function

    Public Function SetProfileString(ByVal section As String, ByVal key As String, ByVal sValue As String) As Boolean
    Return SetProfileString("", section, key, sValue)
    End Function

VB.NET C# (sample code)

    Public bool SetProfileString(string section, string key, string sValue)
    {
        WriteProfileString("", section, key, sValue);
    }

Please add some!

Alternative Managed API:

Do you know one? Please contribute it!

Documentation

Please edit this page!

Do you have...

  • helpful tips or sample code to share for using this API in managed code?
  • corrections to the existing content?
  • variations of the signature you want to share?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).

 
Access PInvoke.net directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version
Revisions