|
Managing INI files
Home » Visual Basic » Introduction to Visual Basic
Managing INI files
How to create, read and write an INI file from Visual Basic 6
Hello y'all. It's a long time that in the italian VB newsgroups periodically appears a thread asking how we can write and read the INI files. I always post the same solution: two little functions of mine, that belong from a code I found somewhere in andreavb.com.
My answer is always the same - and often they give me the same grateful reply - but threads expire after some time in newsgroups, so I'm afraid one of these days I can't post anymore the bare tinyurl link to the thread I spoke into, and I have to write another explanation of the whole stuff.
So I decided to post this article here: to put my functions and explanations in a not-expiring place. If one day my previous threads will be lost, I will tinyurl the link to this page (and then, my italian friends would be better start speaking english, ehehehe).
So, in order to create, read and write an INI file, copy the two routines below in a module.
Things to know:
- INI files are made of sections, which names are enclosed in square brackets into the file (you could open one by the Notepad.exe to see how it is made), and several keys for each sections. Take note that there is no space before equal sign of the key, nor after it: the format is KeyName=Value. In the routines below you have to specify the section, and the name of the key to read/edit in that section.
|
More Tutorials by this user
|
|
|