How to write a text into a text field - vb - InfoPath Dev
in

InfoPath Dev

How to write a text into a text field - vb

Last post 08-16-2012 10:41 AM by Jimmy. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • 08-06-2012 06:51 AM

    How to write a text into a text field - vb

    Hello everybody,

    I don't know how to tranlate the following code from InfoPath 2007 into InfoPath 2010. Because I can not use this code without getting an error. Could you tell me how to translate it into the new version? I think i must use "me...." but I don't know how to use it. I only want to write a text into the textfield:

    • thisXDocument.DOM.selectSingleNode("/my:Root_Element/my:ID").text = strFileName 

    kind regards

    Daniel

  • 08-06-2012 07:49 AM In reply to

    Re: How to write a text into a text field - vb

    MainDataSource.CreateNavigator().SelectSingleNode("/my:Root_Element/my:ID", NamespaceManager).SetValue(strFileName)
    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 08-06-2012 10:10 AM In reply to

    Re: How to write a text into a text field - vb

    I'd like to understand why and how it is being changed at all if Infopath 2010 uses VSTA based on Visual Studio 2005?
    Somehow I was thinking that I could give a code elaborated and checked in 2010 for questions about Infopath 2007... so, it is wrong!

     Also, I was confused by an answer in  comments to http://blogs.msdn.com/b/infopath/archive/2010/03/18/introduction-to-programming-in-infopath-2010.aspx:  

    • "We want everybody who works with InfoPath 2010 to be able to leverage all three versions of our managed OM, the optimized design experience, and the best publish story from a single development environment that ships with Office; VSTA is that story" 

    Since many samples, examples, how-to articles on internet are for 2007 (including this site infopathdev.com), is there a reference how to translate them for running in Infopath 2010?

    Gennady Vanin (Novosibirsk) --- Геннадий Ванин (Новосибирск)
  • 08-16-2012 05:43 AM In reply to

    Re: How to write a text into a text field - vb

    I'm not having any luck figuring out what you mean by this:

    Gennady Vanin (Геннадий Ванин, Новосибирск):
    Somehow I was thinking that I could give a code elaborated and checked in 2010 for questions about Infopath 2007... so, it is wrong!

     Could you clarify that?

    To the best of my knowledge, 2010 is merely a superset of the 2007 OM, and I think 2010 has just added a few extra parts to the OM (I don't know specifically what they are).

     I believe that code written for 2007 will work as 2010 code without any modifications.  Have you found this to be not the case?

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
  • 08-16-2012 09:10 AM In reply to

    Re: How to write a text into a text field - vb

     Jimmy,

    I have never worked with 2007.

    I (mis)understood the question and your (first) reply to it as the statement that Infopath 2007 code does not run in Infopath 2010.

    Gennady Vanin (Novosibirsk) --- Геннадий Ванин (Новосибирск)
  • 08-16-2012 10:41 AM In reply to

    Re: How to write a text into a text field - vb

    I see.  The code in the first post is actually 2003 OM code, which is quite different from 2007 and 2010.  On the other hand, IP 2010 still allows using 2003 code, so I'm not entirely sure why OP was having an issue.

    And I now understand what you meant in that line I quoted.  Code that works in 2010 should work in 2007 99% of the time, so no need to worry about that, but if you want to be sure, you can set a form's OM to the 2007 version in the form options.

    Jimmy Rishe / Software Developer / Microsoft MVP
    Qdabra Software
Page 1 of 1 (6 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.