Go to index number in XML file

I am new to xml and vb.net...so I am probably misunderstanding this process but:

Is it possible to GoTo a specific node index based on a specific nodes value?

I have a list box that is populated by an xml file.  I want to be able to select an item in the list box...and have it GoTo...the corresponding index.

My a very simplified example of my xml file looks kind of like this

<ResourceBook>
<Resources> <--------------------------------(Index1)
<Resource>
<Name>Bob</Name>
</Resource>
<Resource><--------------------------------(Index2)
<Name>Frank</Name>
</Resource>
</Resources>
</ResourceBook>

So...if they select Bob in the listbox...I want currentresourceindex to be 1....how do I do this?

Troy
troyhalseyAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Mikal613Commented:

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
troyhalseyAuthor Commented:
Yes, everyone has told me that.  I have books on xpath....I don't know how to begin using xpath.  Can you provide with a sample of how xpath interacts with vb code?
coopzzCommented:
ok heres a simplified version using xpath in vb.net

'----------Start Code----------'
        Dim oXML As New Xml.XmlDocument
        oXML.LoadXml("<?xml version='1.0'?><ResourceBook><Resources><Resource><Name>Bob</Name></Resource><Resource><Name>Frank</Name></Resource></Resources></ResourceBook>")

        Dim oNodeList As Xml.XmlNodeList = oXML.DocumentElement.SelectNodes("//Resource") 'grab all the Resource Nodes using xpath expression.
if (oNodeList.Count > 0) then
        MsgBox(oNodeList(1).InnerXml) 'grab the second one inner xml
        MsgBox(oNodeList(1).SelectSingleNode("Name").InnerText)
else
        msgbox("None Found..")
end if
'----------END CODE----------'

CooPzZ
troyhalseyAuthor Commented:
No objection, I will repost when I am ready to readdress the issue.  Thank you.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.