I have a separate XML file for a VB.NET project (framework version 1.1) that is being used to persist info between sessions.
the XML file is called DefaultFolders.xml and looks like this:
<DEFAULTSEARCHFOLDER>C:\Documents and Settings\Ross\My Documents\Programming\Projects\Ultra106Five\SoundFiles\SampleSoundFiles</DEFAULTSEARCHFOLDER>
Now I have a Sub Proc that is as follows:
Private Sub SetDefaultSearchFolder(ByVal strFolder As String) 'this sub proc writes the path of the default search folder to the xml file 'DefaultSearchFolder.xml 'the file is in the same directory as the application Dim xmlDoc As New XmlDocument Dim tempNode As XmlNode xmlDoc.Load("C:\Documents and Settings\Ross\My Documents\Programming\Projects\Ultra106Five\SoundFiles\SearchForSoundFiles\DefaultFolders.xml") 'navigate to the element entitled <DEFAULTSEARCHFOLDER> For Each tempNode In xmlDoc.DocumentElement If tempNode.Name = "DEFAULTSEARCHFOLDER" Then tempNode.InnerText = strFolder xmlDoc.Save(xmlDoc.Name.ToString) End If Next End Sub
The proc is called from another proc and appears to run without error.
When I step through the code, the line that says:
tempNode.InnerText = strFolder
appears to work OK, but the xmlDoc.Save doesn't appear to do anything as when I examine the file afterwards it hasn't changed.
So, if somebody could show me the error of my ways (LOL), I would muchly appreciate it.