Condividi tramite


Classe SubmitToHostConnection

Rappresenta una connessione per l'invio dei dati a un ambiente host.

Spazio dei nomi: Microsoft.Office.InfoPath
Assembly: Microsoft.Office.InfoPath (in microsoft.office.infopath.dll)

Sintassi

Public MustInherit Class SubmitToHostConnection
    Inherits DataConnection

Dim instance As SubmitToHostConnection
public abstract class SubmitToHostConnection : DataConnection

Osservazioni

Questo tipo di connessione viene utilizzato in un modello di modulo aperto da un'applicazione che ospita l'ambiente di modifica dei moduli di InfoPath come controllo. Per informazioni sull'hosting di InfoPath come controllo e su come creare un metodo per gestire l'evento di invio di un modulo nel codice dell'applicazione host, vedere l'articolo "Hosting dell'ambiente di modifica dei moduli di InfoPath in un'applicazione Windows Form personalizzata" nel Portale per sviluppatori di InfoPath in MSDN.

Per creare una connessione dati per l'invio dei dati a un ambiente host a cui sia possibile fare riferimento dalla regola business in un modello di modulo, scegliere Connessioni dati dal menu Strumenti. Per informazioni su come creare un gestore eventi da eseguire quando viene generato l'evento Submit, vedere Procedura: Aggiungere un gestore eventi.

Esempio

Nell'esempio seguente viene mostrato uno schema per scrivere codice che consente di eseguire azioni personalizzate nella regola business di un modello di modulo prima dell'invio del modulo.

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

Gerarchia di ereditarietà

System.Object
   Microsoft.Office.InfoPath.DataConnection
    Microsoft.Office.InfoPath.SubmitToHostConnection

Thread Safety

Tutti i membri statici pubblici (Shared in Visual Basic) di questo tipo sono thread-safe. I membri di istanza non sono garantiti come thread-safe.

Vedere anche

Riferimenti

Membri SubmitToHostConnection
Spazio dei nomi Microsoft.Office.InfoPath