Click here to Skip to main content
15,881,172 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My file consists of...
[Vegetables]
cucumber
tomato
.
.
[Fruits]
banana
apple
.
.

[Customer]
Total = 3
[Customer 1]
.....
......
[Customer 2]
..........


IF i delete any one of the customer with a help of combo Box, the updated list and along with the selected items should be present at the same position..

Please help me out, i stucked in deleting.
Posted

1 solution

You can't "delete" from a text file - you have to create a new file, copy the data from the start up to the point of deletion, skip the deleted part, then copy the rest of the file up to the end. Then rename the original as .BAK or similar, and rename the copy to the original file name.

But...that looks like an INI file, and they are seriously outdated. Unless this is legacy data, you probably shouldn't be using INI format as there are a lot of better, more modern formats. If you must process them though, you can use WritePrivateProfileStruct[^] to delete sections and it will do all that for you.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900