次の方法で共有


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 で「カスタム WinForm アプリケーションでの 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

スレッド セーフ

この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。

関連項目

参照

SubmitToHostConnection のメンバ
Microsoft.Office.InfoPath 名前空間