Settings.xml write / read ?
i want to save the value of a FolderBrowserDialog to the settings.xml file
my current xml save code is as follows :
private void WriteAppSetting( string strFilePath, string strKey, string strValue )
{
XmlDocument xmlDoc = new XmlDocument();
XmlNode xmlSettingsNode;
XmlElement xmlSettingsElement = xmlDoc.DocumentElement;
xmlDoc.Load ( strFilePath );
xmlSettingsNode = xmlDoc.SelectSingleNode ( "/configuration/appSettings" );
for ( int nDex=0; nDex < xmlSettingsNode.ChildNodes.Count; nDex++ )
{
if ( xmlSettingsNode.ChildNodes[nDex].Attributes["key"].Value.ToString() == strKey )
{
xmlSettingsNode.ChildNodes[nDex].Attributes["value"].Value = strValue;
break;
}
}
xmlDoc.Save(strFilePath);
}
and my folderbrowse code is :
private void button2_Click(object sender, System.EventArgs e)
{
System.Windows.Forms.FolderBrowserDialog fbd = new
DialogResult result = fbd.ShowDialog(this);
if( result == DialogResult.OK )
{
textBox1.Text = fbd.SelectedPath;
}
}
i need to add some code to this part :
{
textBox1.Text = fbd.SelectedPath;
.......code here......
}
but i am unsure ( being a newbie ;) )
can somebody help , thanks