Unable to load formcontrol with form

S

steverino

I designed a simple form and published it to a local directory as
"C:\PROJECTS\publish\Template1.xsn". I then have a Visual Studio 2005
project where the FormControl is hosted on the windows form. When the
windows form loads, it runs the following code::::::::::

Private Sub viewOasis_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Try
Dim myForm As String = "C:\PROJECTS\publish\Template1.xsn"
'Open a form based on the solution
FormControl1.SetSubmitToHostEventHandler(Me)
FormControl1.NewFromFormTemplate(myForm)
Catch ex As Exception
showException(ex)
End Try
End Sub

when it tries to load the form, I get the following message::::::::

InfoPath cannot create a new, blank form.
InfoPath cannot open the form. To fix this problem, contact your system
administrator.

Form template: C:\PROJECTS\publish\Template1.xsn
The following form template for the form cannot be found:
file:///C:\PROJECTS\publish\Template1.xsn

at
Microsoft.Office.Interop.InfoPath.InfoPathEditorObjectClass.NewFromSolution(String bstrSolutionURI)
at Microsoft.Office.InfoPath.FormControl.NewFromFormTemplate(String
formTemplateLocation)
at TimeTrackApp.viewOasis.viewOasis_Load(Object sender, EventArgs e) in
C:\PROJECTS\TimeTrackApp\TimeTrackApp\UseCases\OASISManagement\viewOasis.vb:line 10

I followed the example as given by microsoft in "Hosting the InfoPath 2007
Form Editing Environment in a Custom Windows Form Application", however it is
not working for me. Any suggestions as to what may be wrong?

thx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top