Sending data to text field VB.net - Infopath 2013 - InfoPath Dev
in

InfoPath Dev

Use our Google Custom Search for best site search results.

Sending data to text field VB.net - Infopath 2013

Last post 01-29-2016 02:59 PM by Hilary Stoupa. 1 replies.
Page 1 of 1 (2 items)
Sort Posts: Previous Next
  • 01-27-2016 09:23 AM

    • redsky
    • Not Ranked
    • Joined on 01-27-2016
    • Posts 1

    Sending data to text field VB.net - Infopath 2013

     Hi all,

     I'm currently trying to set a field to 1 when another field is changed. All the tests in VSTA works but when I run infopath it crashes. Any help on this would be amazing! 

    Here's the code: 

     Public Sub Incoming_Agent_Login_Changed(ByVal sender As Object, ByVal e As XmlEventArgs)
                Dim node As IHTMLDOMNode
                node = MainDataSource.CreateNavigator().SelectSingleNode("/my:myFields/my:Retrieve_Info", NamespaceManager)
                node.text = "1"
            End Sub

     And the error:

      System.InvalidCastException
    Unable to cast object of type 'Microsoft.Office.InfoPath.MsxmlNavigator' to type 'mshtml.IHTMLDOMNode'.
       at NSTAT_v5pt5_0.FormCode.Incoming_Agent_Login_Changed(Object sender, XmlEventArgs e) in C:\Users\wilcojos\AppData\Local\Temp\vsta\1e5cd4420e40498dbbc128d44b5946e0\FormCode.vb:line 46
       at Microsoft.Office.InfoPath.Internal.XmlEventHost.GenericProxy(Object genericDelegate, DataDOMEvent dataDOMEvent, InfoPathEvents type)
       at Microsoft.Office.InfoPath.Internal.XmlEventHost.ChangedProxy(DataDOMEvent dataDOMEvent)
       at Microsoft.Office.Interop.InfoPath.SemiTrust._DataDOMEventSink_SinkHelper.OnAfterChange(DataDOMEvent pDataDOMEvent)

    Been searching and searching but cannot find an answer. Thank you in advance. :)

  • 01-29-2016 02:59 PM In reply to

    Re: Sending data to text field VB.net - Infopath 2013

     Your node variable should be an XPathNavigator in InfoPath - here's an MSDN link. https://msdn.microsoft.com/en-us/library/bb509311(v=office.12).aspx - it says it is for IP 2007, but 2010 and 2013 use very similar concepts.

    Hilary Stoupa

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