Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I add a 3rd condition to my vb.net code?

Status
Not open for further replies.

momo2000

Programmer
Jan 2, 2015
63
0
0
US
In the xml document below, I would like to check for 3 things

1. If Phone/@Current ='true'
2. If Type/@Word ='HOME'
3. If Invalid is not true

I have done 1 and 2 but I am not sure how to do 3 in the same line of code.

My xml document which is put into an object objxmlPhoneNode

XML:
<?xml version="1.0" encoding="UTF-8"?>
<Phone Op="A" Current="true">
	<Type Op="A" Word="HOME">Home</Type>
	<Number Op="A">444-081-7031</Number>
	<Invalid>true</Invalid>
</Phone>



I have taken care of condition number 1 and 2. I need hep to add condition 3. i.e. If Invalid is not true.

Code:
objxmlPhoneNode = objXmlPartyNode.SelectSingleNode("Phone[@Current='true' and Type/@Word='HOME']")
 
Have you tried:
Code:
"Phone[@Current='true' and Type/@Word='HOME' and Invalid != 'true']"

Tom Morrison
Consultant
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top