SubmitToHostConnection 類別
代表用來送出資料至主機環境的連線。
**命名空間:**Microsoft.Office.InfoPath
**組件:**Microsoft.Office.InfoPath (於 microsoft.office.infopath.dll 中)
語法
'宣告
Public MustInherit Class SubmitToHostConnection
Inherits DataConnection
'用途
Dim instance As SubmitToHostConnection
public abstract class SubmitToHostConnection : DataConnection
備註
在將 InfoPath 表單編輯環境裝載成控制項之應用程式所開啟的表單範本中,會使用這種類型的連線。如需將 InfoPath 裝載成控制項的詳細資訊,包括如何在主應用程式的程式碼中建立方法來處理送出表單之事件的詳細資訊,請參閱 MSDN 上 InfoPath Developer Portal 的文章<在自訂應用程式中裝載 InfoPath 表單編輯環境>(英文)。
若要建立資料連線,用來將資料送出至可由表單範本中商務邏輯參照的主機環境,請使用 [工具] 功能表上的 [資料連線] 命令。如需如何建立會在引發 Submit 事件時執行之事件處理常式的詳細資訊,請參閱操作方法:新增事件處理常式。
範例
下列範例會示範撰寫程式碼的型態,此程式碼會在送出表單之前在表單範本的商務邏輯中執行自訂動作。
public void FormEvents_Submit(object sender, SubmitEventArgs e)
{
// Get the data connection defined in the form template from the
// DataConnections collection and cast to the SubmitToHostConnection
// type.
SubmitToHostConnection submitConnection =
(SubmitToHostConnection)(DataConnections["MyHostConnection"]);
// Write code here to do custom actions that are not
// supported by rules or other declarative settings.
// Execute the submit operation against the connection.
submitConnection.Execute();
}
Public Sub FormEvents_Submit(ByVal sender As Object, _
ByVal e As SubmitEventArg)
' Get the data connection defined in the form template from the
' DataConnections collection and cast to the SubmitToHostConnection
' type.
Dim submitConnection As SubmitToHostConnection = _
DirectCast(DataConnections("MyHostConnection"), _
SubmitToHostConnection)
' Write code here to do custom actions that are not
' supported by rules or other declarative settings.
' Execute the submit operation against the connection.
submitConnection.Execute()
End Sub
繼承階層
System.Object
Microsoft.Office.InfoPath.DataConnection
Microsoft.Office.InfoPath.SubmitToHostConnection
執行緒安全
此型別的所有公用靜態 (於 Visual Basic 共用) 成員都是執行緒安全。但並不保證所有執行個體成員為執行緒安全。