Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleRead and write INI files
KeywordsINI file, initialization file, registry
CategoriesTips and Tricks
 
Use the GetPrivateProfileString, GetPrivateProfileInt, and WritePrivateProfileString SPI functions.
 
' Get the value.
Private Sub cmdGet_Click()
Dim buf As String * 256
Dim length As Long

    length = GetPrivateProfileString( _
        txtApplication.Text, txtKey.Text, "<no value>", _
        buf, Len(buf), txtFilename.Text)
    txtValue.Text = Left$(buf, length)
End Sub

' Set the value.
Private Sub cmdSet_Click()
    WritePrivateProfileString _
        txtApplication.Text, txtKey.Text, _
        txtValue.Text, txtFilename.Text
    txtValue.Text = "Ok"
End Sub
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated