 <p>Try this:</p> <pre><code>var element = root.GetElementsByTagName("Intelejen")[0]; if (element != null) txt10.Text = element.InnerText </code></pre> <p>Explanation: <code>root.GetElementsByTagName("Intelejen")[0]</code> returns null if no element is found. That is why <code>InnerText</code> throws a null exception</p>