#Troubles with .INI editing on Windows Forms

42 messages · Page 1 of 1 (latest)

civic root
#

i cant remove key from ini file, while im deleteing item. probably cuz my brains are dead and i cant find variable what i need.

#

i have deadline in 6 hoursgopher_heart

stark wedge
#

Do you write the .ini back to disk?

#

Also love the cursing in code, literally me

#

you write this to the file

#

For creating I assume

#

Then in the delete button handler you never actually save the ini file back to disk

civic root
stark wedge
civic root
civic root
#

OH

#

wait

stark wedge
#

I believe the DeleteKey takes in a section and a key, not sure how much that matters here

#

But to me it looks like you never save the updated file (with the deleted entry removed)

civic root
#

damn

stark wedge
#

I guess I looked at the wrong docs then 😂

civic root
#

lemme try ig

#

but currently im thinking the problem is variable. i tried all vars here (FUCK.SelectedItems, FUCK.SelectedItems[i], i) and no one working

stark wedge
#

Do you ever save back the modified IniFile?

civic root
#

it doesnt needs to be saved, it automatically writes changes to ini, if i understand you right

stark wedge
#

Yeah let me pull up the docs real quick

civic root
#

nope

stark wedge
#

Oh sorry I didn't see the SO post includes a IniFile wrapper

#

It looks like DeleteKey expects you to provide the key and an optional section

#

Have you tried passing in the correct section string as well?

civic root
#

you mean paste the section too?

stark wedge
#

MyIni.DeleteKey("ID" + i);

#

this one

#

Your section name is LIST

#

So I'd try doing MyIni.DeleteKey("ID" + i, "LIST");