VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



How To Write To a INI File

by Randy Porosky (6 Submissions)
Category: Files/File Controls/Input/Output
Compatability: Visual Basic 3.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating: (2 Votes)

This VERY Simple 5 Line Code Writes To a INI File! Enjoy!

Assumes
Place a Command Button on The Form, Name it Command1. Put The 1 Declaration in a Module. Have Fun!
API Declarations
Declare Function WritePrivateProfileString Lib "kernel32" _
Alias "WritePrivateProfileStringA" (ByVal lpApplicationName _
As String, ByVal lpKeyName As Any, ByVal lpString As Any, _
ByVal lpFileName As String) As Long

Rate How To Write To a INI File

Public Sub iniWrite(sFileName As String, sKey As String, sSection As String, ByVal sValue As String)
Dim iW As String
iW = WritePrivateProfileString(sSection, sKey, sValue, sFileName)
End Sub
Private Sub Command1_Click()
iniWrite "C:\Windows\Desktop\File.ini", "Neat", "Pretty", "Huh?"
End Sub
'Have Fun!

Download this snippet    Add to My Saved Code

How To Write To a INI File Comments

No comments have been posted about How To Write To a INI File. Why not be the first to post a comment about How To Write To a INI File.

Post your comment

Subject:
Message:
0/1000 characters