title: Replace a value in an XML file
body: <p>I'm trying to load an XML file, replace a specific value, and then save the file.</p>
  
  <p>Here is what the file looks like:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;PremiereData Version="3"&gt;
    &lt;Project ObjectRef="1" /&gt;
    &lt;Project ObjectID="1" ClassID="62ad66dd-0dcd-42da-a660-6d8fbde94876" Version="36"&gt;
      &lt;Node Version="1"&gt;
        &lt;Properties Version="1"&gt;
          &lt;ProjectViewState.List ObjectID="2" ClassID="aab0946f-7a21-4425-8908-fafa2119e30e" Version="3"&gt;
            &lt;ProjectViewStates Version="1"&gt;
  </code></pre>
  
  <p>I'm trying to update the 4th line in the example - with <code>Version="36"</code>. The problem I'm having is that the 36 integer changes from file to file and it could have any number. And also the file has a few instances of the string Version. So how do I replace that first version?</p>
  
  <p>Here's what I tried:</p>
  
  <pre class="lang-vb prettyprint-override"><code>Dim gzFile As String = "C:\users\desktop\delete.txt"
  Dim doc As XmlDocument = New XmlDocument
  Dim xmlReader As XmlTextReader = New XmlTextReader(gzFile)
  doc.Load(xmlReader)
  Dim nodes As XmlNodeList = doc.SelectNodes("PremiereData/Project/Project")
  
  MsgBox(doc.SelectSingleNode("PremiereData/Project/Project".ToString))
  
  For Each node As XmlNode In nodes
      MsgBox(node.Attributes("Version").Value.ToString)
  
      If node.Attributes("Version").Value.ToString Is "36" Then
          MsgBox("found")
          node.Attributes("Version").Value = "16"
      End If
  Next
  
  xmlReader.Close()
  doc.Save(gzFile)
  </code></pre>