When I press the btnUpdate to show the specific elements from my XML file, it first shows the exist elements but if there is no more it's gonna show me an exception error which says "Object reference not set to an instance of an object."
Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnUpdate.Click
Dim xelement As XElement = xelement.Load(cbFileName.Text)
Dim Data As IEnumerable(Of XElement) = xelement.Elements()
For Each dat In Data
MsgBox(dat.Element("Name").Value & "...." & dat.Element("Tel").Value) 'Error is from this part'
Next dat
End Sub
and here is my xml file
<Data>
<Person>
<Name>Alireza</Name>
<Email>a@a.com</Email>
<Tel>123</Tel>
</Person>
<Others>
<Other_Info>This is NOOOOTTHHIIINNNG</Other_Info>
</Others>
</Data>