title: Find all the child node of specific value in C#
body: <pre><code>&lt;main&gt;
    &lt;myself&gt;
      &lt;pid&gt;1&lt;/pid&gt;
      &lt;name&gt;abc&lt;/name&gt;
    &lt;/myself&gt;
    &lt;myself&gt;
      &lt;pid&gt;2&lt;/pid&gt;
      &lt;name&gt;efg&lt;/name&gt;
    &lt;/myself&gt;
  &lt;/main&gt;
  </code></pre>
  
  <p>that is my XML file named simpan. I have two button. next and previous. What i want to do is, all the info will shows off on the TextBox when the user click the button. The searching node will be based on the pid. </p>
  
  <p>Next button will adding 1 value of pid (let's say pid=2) and it will search on the node that have the same value of pid=2. it also will show the name for the pid=2. (showing name=abc)</p>
  
  <p>Same goes to the previous button where it will reduce 1value of pid (pid=1).</p>
  
  <p>Does anybody knows how to do this?</p>
  
  <p>//-------------EDIT------------------</p>
  
  <p>thanks to L.B, im trying to use his code. however i got an error.</p>
  
  <p><img src="https://i.stack.imgur.com/46MAk.png" alt="enter image description here"></p>
  
  <p>is my implementation of code correct?</p>
  
  <pre><code>private void previousList_Click(object sender, EventArgs e)
      {
          pid = 14;
  
          XDocument xDoc = XDocument.Parse("C:\\Users\\HDAdmin\\Documents\\Fatty\\SliceEngine\\SliceEngine\\bin\\Debug\\simpan.xml");
  
          var name = xDoc.Descendants("myself")
                      .First(m =&gt; (int)m.Element("PatientID") == pid)
                      .Value;
  
          textETA.Text = name;
          ////////////////////
  
  
      }
  </code></pre>