Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / General MS InfoPath Questions / June 2006

Tip: Looking for answers? Try searching our database.

why object required in selectsinglenode

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mint - 26 Jun 2006 04:36 GMT
i want to click the button and it alerts the text that filds in.
my fields is:
myFields
 test
i use the code:
XDocument.UI.Alert(XDocument.DOM.selectSingleNode("/myFields/test").text);
but failed , it warns that "Object required!"
i have read the SDK,the sample code also uses the code like mine.why
the sampale can use it, not mine?
i change the code to:
XDocument.UI.Alert(XDocument.DOM.selectSingleNode("//my:myFields/my:test").text);
it is ok.
is there any difference?
can anyone help me ?
when will use"/", and "//", and "my:"
many thanx!
Greg Collins [InfoPath MVP] - 28 Jun 2006 03:06 GMT
the "my:" is called a namespace prefix. It is essential. It is part of the name of the node.

"myFields" is entirely different than "my:myFields"... just as "yo:myFields" would be different.

The "/" is just fine in your scenario... no need to use "//".

Signature

Greg Collins [Microsoft MVP]
Visit Brain Trove ( http://www.BrainTrove.com )
Visit InfoPath Dev ( http://www.InfoPathDev.com )

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.