By the way, you could get rid of the INI and use GetSetting, SaveSetting, and DeleteSetting to save your INI settings into the registry.
Cheers!
Main Topics
Browse All TopicsI have an application in VB6 that uses an .ini to store certain variable values relating to the condition of the program that can be changed by the user. When the user changes any one or all the values, I would like to delete the old values in the ini file and replace with the new values. When I use WritePrivateProfileString all that happens is that the new values are appended to the section involved leaving the old keys and old values like this:
[Section 1]
Key 1 = "Value" (this is the old value)
Key 1 = "New Value"
As you can see, if I want the program to read the value of Key 1 in Section 1, there will be a problem. So is there an API call that I am missing that would delete the old Key 1 and its accompanying value and replace it with new Key 1 and its new value?
Or is there some other way to do this?
Thank you for your help.
Hawkeye67
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
This question was awarded, but never cleared due to the JSP-500 errors of that time. It was "stuck" against userID -1 versus the intended expert whom you awarded. This corrects the problem and the expert will now receive these points; points verified.
Please click on your Member Profile and select "View Question History" to navigate through any open or locked questions you may have to update and finalize them. If you are an EE Pro user, you can also choose Power Search to find all your open questions.
This is the Community Support link, if help is needed, along with the link to All Topics which reflects many TAs recently added.
http://www.experts-exchang
http://www.experts-exchang
Thank you,
Moondancer
Moderator @ Experts Exchange
Business Accounts
Answer for Membership
by: mcriderPosted on 1999-09-20 at 15:01:25ID: 2061084
This code will delete an INI entry:
A"(Section $, Key$, Value As Long, FName$) As Long
Section$, Key$, 0, FName$)
-------- ownloads.s html
Declare Function WritePrivateProfileString Lib "kernel32" Alias _
"WritePrivateProfileString
Sub MAIN
FName$ = "C:\TEST.INI"
Section$ = "Section"
Key$ = "Entry1"
x = WritePrivateProfileString(
End Sub
Cheers!
--------------------------
Need to search Experts Exchange?
Goto http://www.caas.com/html/d