See if this helps.
1 Button
Imports System.Xml
Public Class Form1
Private myXML_FileLocation As String = "C:\test.xml" '// .xml file and location.
Private xmlDoc As New XmlDocument, xmlSelectedNode As XmlNode
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
xmlDoc.Load(myXML_FileLocation) 'Load the Xml file once if constantly in use.
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
getXMLnodeByID("2")
End Sub
Private Sub getXMLnodeByID(ByVal IDToUse As String)
xmlSelectedNode = xmlDoc.SelectSingleNode("Subject/Items/Item[@id='" & IDToUse & "']")
With xmlSelectedNode
MsgBox(.SelectSingleNode("CustName").InnerText)
MsgBox(.SelectSingleNode("Filename").InnerText)
MsgBox(.SelectSingleNode("StartDate").InnerText)
'// etc...
End With
End Sub
End Class I noticed that your .xml file has <Item id="1"> which is all LowerCase and you were using ("/Subject/Items/Item[@ID='1']") .ToUpper, which will result in errors. At least it did on my part.