current doc object C# & InfoPath07 - InfoPath Dev
in

InfoPath Dev

current doc object C# & InfoPath07

Last post 03-21-2009 05:14 AM by Hilary Stoupa. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 03-20-2009 03:09 PM

    • dpenny
    • Not Ranked
    • Joined on 03-20-2009
    • Silicon Valley
    • Posts 5

    current doc object C# & InfoPath07

    Am a newbie at C# behing InfoPath07 forms. Am doing simple things like MsgBox of various fields. I can't get the following to work because I cannot figure out how to get the current form (document) as an object.

    thisXdocument.DOM.selectSingleNode(xpath blah.....blah).value

    The example I am following gets thisXdocument from _Startup method. But I do not have one of these in the stubs provided by the environment.

    I am on an Office07 XP machine with VSTA. No VisualStudio at all. 

     

    dpenny
  • 03-21-2009 05:14 AM In reply to

    Re: current doc object C# & InfoPath07

    Hi --

    There is a difference between IP2003 and 2007 object models. The example you are following is probably IP2003. You can either change your form to use the older OM, so you can follow the sample, or you can try to upgrade the sample code.

    To change your form, under Tools / Form Options / Programming you can remove your existing code and change the programming language to C# (InfoPath 2003). To try to update the code, you can use this article from MSDN as a guide.

    Use this to refer to the current document in C# for 2007 (Me for VB.NET).

    In IP2007, to get the value of a field:

    MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/my:textField", this.NamespaceManager).Value
    Hilary Stoupa

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