in

InfoPath Dev

XDocument Error

Last post 06-04-2008 12:30 PM by JillErin. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 06-03-2008 11:52 AM

    XDocument Error

    Hello!

    I just made my first real form with Infopath, and I want to add a field that will automatically generate a numeric code based on a name in a different text box.  I found code that does this with a case statement.  However, I am being told that "XDocument" needs to be declared.

    Here is the line:

    fieldProduct = XDocument.DOM.SelectSingleNode("/my:myFields/my:ProductName").text

    I am using the Microsoft Visual Studio Tools for Applications, InfoPath 2007, and VBScripting.  I've only just started learning different scripts for work, so I wouldn't be surprised if the solution is something simple.

    Thank you!

  • 06-03-2008 01:04 PM In reply to

    Re: XDocument Error

    I am using infopath 2007 but most of my code is backward compatible with 2003.  If you are writing the code to be compatible with 2007, then I don't think you use xDocument.  In my vb.net code when referring to a text box I use: thisXDocument.DOM("xpath-to-field").text.

    In your case I think you need to use something like this:

    Dim field1 As XPathNavigator = Me.CreateNavigator().SelectSingleNode("/my:myFields/my:field1", Me.NamespaceManager)

  • 06-04-2008 12:30 PM In reply to

    Re: XDocument Error

    Thank you!  That helped with the whole xDocument error.  However, now I'm getting errors about the values not being able to convert to a string (and vice versa).

Page 1 of 1 (3 items)
Copyright © 2003-2007 Qdabra Software. All rights reserved.
View our Terms of Use.