Jump to content

InfoPath 2007 using C# & XML


Guest lyntonS

Recommended Posts

Guest lyntonS

My names Lynton and I was wondering if you could assist me with a troubling problem. I am new to the developing world and particularly to InfoPath. My skills at unlocking XML are thus rudimentary at best. I really could use some help. I have attempted to localize a much larger project I am working with so that I can understand the basics first.I have created two forms: PassingParameters.xsn (Contains a TextBox(txtInput) and a Button(btnSubmit))ReceivedParameters.xsn (Contains just a TextBox (output) that is for displaying)What I am trying to accomplish at first appeared very easy, but has become my nemesis! All that I want to do is pass the value I input in the TextBox on the 1st form to the TextBox on the 2nd form? Here is the code that I am trying to work with. It revolves around the NewFromSolutionWithData Method.[infoPathEventHandler(MatchPath = "btnSubmit", EventType = InfoPathEventType.OnClick)] public void btnSubmit_OnClick(DocActionEvent e) { IXMLDOMProcessingInstruction oXML = thisXDocument.DOM.createProcessingInstruction("xml", "version=\"1.0\" encoding=\"UTF-8\""); IXMLDOMProcessingInstruction oPI = thisXDocument.DOM.createProcessingInstruction("mso-application", "progid=\"InfoPath.Document\""); thisXDocument.DOM.insertBefore((IXMLDOMNode)oPI, thisXDocument.DOM.firstChild); thisXDocument.DOM.insertBefore((IXMLDOMNode)oXML, thisXDocument.DOM.firstChild); // Open a solution from a XML DOM // Create a new DOM IXMLDOMDocument newDoc = thisXDocument.CreateDOM(); string myXml = "<txtInput></txtInput>"; newDoc.loadXML(myXml); // Call NewSolutionWithData to open a new Form and load the XML XDocument oXdpostingForm = thisApplication.XDocuments.NewFromSolution(@"C:\Program Files\bSOLVe_LS_Publish\PassingParameters.xsn"); XDocument oXdreceivingForm = thisApplication.XDocuments.NewFromSolutionWithData ("C:\\Program Files\\bSOLVe_LS_Publish\\Source_ParametersReceived\\template.xml", @"C:\Program Files\bSOLVe_LS_Publish\ParametersReceived.xsn", (int)XdDocumentVersionMode.xdFailOnVersionOlder);I design the forms in a folder called bSOLVe_LS_Design giving them full trusted security. Once completed I publish the forms to another folder bSOLVe_LS_Publish, where I also install them. When I run the form I get the following exception:InfoPath cannot create a new, blank form. The system cannot find the path specified. at Microsoft.Office.Interop.InfoPath.SemiTrust.XDocumentsCollectionWrapper.NewFromSolutionWithData (Object varXMLData, Object varSolutionURI, Int32 dwBehavior)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...