
26/09/2008, 09:20
|
| | | Fecha de Ingreso: noviembre-2004
Mensajes: 1
Antigüedad: 21 años, 1 mes Puntos: 0 | |
| Respuesta: C# -> App.config no puedo modificarlo desde el programa :S Change values as XML file
public void editConfig(string key, string value)
{
XmlDocument Config = new XmlDocument();
string path = "Here your .Config File path";
Config.Load(path);
XmlNodeList apps = Config.GetElementsByTagName("appSettings");
XmlNodeList list = ((XmlElement)apps[0]).GetElementsByTagName("add");
foreach (XmlElement nodo in list)
{
if (nodo.GetAttribute("key") == key)
{
nodo.SetAttribute("value",value);
break;
}
}
Config.Save(path);
}
Última edición por Ralstlin; 26/09/2008 a las 09:27 |