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)



Re: Visual Studio Tools for Office InfoPath 2007 using C# Managed Code NewFromSolutionWithData

John R. Durant - MSFT

Lynton,

You will get a more expert response by posting your question to a forum monitored by dedicated InfoPath experts. This forum is for issues relating mostly to the developer tools as such. That said, we try to answer domain-specific questions when possible. Here's a great place to start for InfoPath help:

http://msdn2.microsoft.com/en-us/office/aa905442.aspx

Let me know if I can be of further assistance.

jrd