I know this is a simple question but I am stuck. I have a simple WinForms application that collects the server name, username, and password and then under service credentials, the account and password. I simply want to write these values to an XML text file (not a database). I guess it should create the file if it doesn't exist. Do I need to create a root element? Can someone please help me out?
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox txtServerName;
private System.Windows.Forms.TextBox txtDatabaseUserName;
private System.Windows.Forms.TextBox txtDatabasePassword;
private System.Windows.Forms.TextBox txtServicePassword;
private System.Windows.Forms.TextBox txtAccount;
All I have so far is:
private void btnSave_Click(object sender, System.EventArgs e)
{
string fileName = System.IO.Path.Combine(Application.StartupPath, "alphaService.xml");
XmlDocument doc = new XmlDocument();
doc.LoadXml(fileName);
XmlNode databaseServer = doc.CreateElement("DatabaseServer");
XmlNode databaseUserName = doc.CreateElement("DatabaseServerName");
}