SubmitToHostAdapterObject interface
This type is a wrapper for a coclass that is required by managed code for COM interoperability. Use this type to access the members of the COM interface implemented by this coclass. For information about the COM interface, including a link to descriptions of its members, seeSubmitToHostAdapter.
Namespace: Microsoft.Office.Interop.InfoPath.SemiTrust
Assembly: Microsoft.Office.Interop.InfoPath.SemiTrust (in Microsoft.Office.Interop.InfoPath.SemiTrust.dll)
Syntax
'Declaration
<GuidAttribute("096cd739-0786-11d1-95fa-0080c78ee3bb")> _
Public Interface SubmitToHostAdapterObject _
Inherits SubmitToHostAdapter
'Usage
Dim instance As SubmitToHostAdapterObject
[GuidAttribute("096cd739-0786-11d1-95fa-0080c78ee3bb")]
public interface SubmitToHostAdapterObject : SubmitToHostAdapter
Remarks
This type of connection is used in a form template that is opened by an application that is hosting the InfoPath form editing environment as a control. For information about hosting InfoPath as a control, including information on how to create a method to handle the event for submitting a form in your host application’s code, see the article titled "Hosting the InfoPath Form Editing Environment in a Custom WinForm Application" on the InfoPath Developer Portal on MSDN.
To create a data connection for submitting data to a hosting environment that can be referenced from business logic in a form template, use the Data Connections command on the Tools menu. For information on how to create an event handler that will run when the OnSubmitRequest event is raised, see How to: Add an Event Handler Using the InfoPath 2003 Object Model.
Examples
The following example shows a pattern for writing code that will perform custom actions in a form template's business logic before the form is submitted.
[InfoPathEventHandler(EventType = InfoPathEventType.OnSubmitRequest]
public void FormEvents_OnSubmitRequest(DocReturnEvent e)
{
// Get the data adapter defined in the form template from the
// DataAdapters collection and cast to the SubmitToHostAdapter
// type.
SubmitToHostAdapter submitAdapter =
(SubmitToHostAdapter)(DataAdapters["MyHostAdapter"]);
// Write code here to do custom actions that are not
// supported by rules or other declarative settings.
// Execute the submit operation against the adapter.
submitAdapter.Submit();
}
<InfoPathEventHandler(EventType := InfoPathEventType.OnSubmitRequest)>
Public Sub FormEvents_OnSubmitRequest(ByVal e As DocReturnEvent)
' Get the data connection defined in the form template from the
' DataAdapters collection and cast to the SubmitToHostAdapter
' type.
Dim submitAdapter As SubmitToHostAdapter = _
DirectCast(DataAdapters("MyHostAdapter"), _
SubmitToHostAdapter)
' Write code here to do custom actions that are not
' supported by rules or other declarative settings.
' Execute the submit operation against the connection.
submitAdapter.Submit()
End Sub