Editing Ini Files In Visual C# -


i trying use edit ini, cannot seem code add section of ini file richtextbox.

        if (myini.getsection(string.format("[{0}]", combobox1.selecteditem.tostring().toupper())) != null);         {             mysection = new inifile.inisection(myini, string.format("{0}", combobox1.selecteditem.tostring().toupper()));             foreach (inifile.inisection.inikey key in mysection.keys)             {                 richtextbox1.appendtext(string.format("{0}={1}{2}", key.name, key.value, environment.newline));             }         } 

i don't know wrong code.

you can use old existing ini calls windows:

[system.runtime.interopservices.dllimport("kernel32")] static extern int getprivateprofilestring(string section,         string key, string def, stringbuilder retval,         int size, string filepath); [system.runtime.interopservices.dllimport("kernel32")] static extern long writeprivateprofilestring(string section,         string key, string val, string filepath); 

...

stringbuilder temp = new stringbuilder(255); getprivateprofilestring("section", "key", "default", temp, 255, inifilename); string value = temp.tostring();   writeprivateprofilestring("section", "key", value, inifilename); 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -