using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Xml; namespace Test { public partial class Form2 : Form { private string g_str_RUTA = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\XML_DatosPrueba.xml"; public Form2(string _str_Servidor, string _str_BaseDatos, string _str_Usuario, string _str_Clave, string _str_IdUsuario) { InitializeComponent(); txt_Servidor.Text = _str_Servidor; txt_BaseDatos.Text = _str_BaseDatos; txt_Usuario.Text = _str_Usuario; txt_Clave.Text = _str_Clave; txt_IdUsuario.Text = _str_IdUsuario; } private void btn_Actualizar_Click(object sender, EventArgs e) { XmlDocument XDox = new XmlDocument(); XDox.Load(g_str_RUTA); XmlNode obj_NodoPadre = XDox.GetElementsByTagName("Datos")[0]; obj_NodoPadre["servidor"].InnerText = txt_Servidor.Text; obj_NodoPadre["basedatos"].InnerText = txt_BaseDatos.Text; obj_NodoPadre["usuario"].InnerText = txt_Usuario.Text; obj_NodoPadre["clave"].InnerText = txt_Clave.Text; obj_NodoPadre["idusuario"].InnerText = txt_IdUsuario.Text; XDox.Save(g_str_RUTA); Application.Restart(); this.Close(); } private void Form2_FormClosing(object sender, FormClosingEventArgs e) { Application.Exit(); } } }