Konten ini tidak tersedia dalam bahasa Anda dan berikut adalah versi bahasa Inggris.

FormEvents.Sign event

Office 2013 and later

Occurs after a set of signed data has been selected to sign through the Digital Signatures dialog box.

Namespace:  Microsoft.Office.InfoPath
Assembly:  Microsoft.Office.InfoPath (in Microsoft.Office.InfoPath.dll)

public abstract event SignEventHandler Sign


The developer attempted to bind the event in some location other than the InternalStartup method.


The form template is not configured for Full Trust using the Security and Trust category of the Form Options dialog box.

Important noteImportant

The Sign event is not meant to be instantiated by the developer in form code. You should only add event handlers for form-level events from the Microsoft InfoPath design mode user interface. When you add an event handler to your form template from the design mode user interface, InfoPath generates code in the InternalStartup method of your form code file using the EventManager class and the member of the FormEvents class to bind the event to its event handler. For information on how to add event handlers in InfoPath design mode, see How to: Add an Event Handler.

The Sign event is bound using the SignEventHandler delegate.

An event handler for this event requires the Full Trust security level to run. To set this security level, in the InfoPath designer click the File tab, click Form Options, select Security and Trust, uncheck Automatically determine security level, and then select Full Trust. A form set to the Full Trust security level must be installed or digitally signed.

You can use the event handler for the Sign event to add additional data to the digital signature. For example, you can add data from a trusted timestamp server, or add a server-side countersignature of the transaction. You can also use the event handler to block signing if the current user is not a member of a particular group.

This member can be accessed only by forms opened from a form template that has been configured to run with full trust using the Security and Trust category of the Form Options dialog box. This member requires full trust for the immediate caller and cannot be used by partially trusted code. For more information, see "Using Libraries from Partially Trusted Code" on MSDN.

This type or member can be accessed only from code running in forms opened in Microsoft InfoPath Filler.

In the following example, created by adding an event handler for the Sign event to the form by clicking Sign Event on the Developer tab in the InfoPath design mode user interface, a digital signature is added to the form by using the Sign method of the Signature class.

public void FormEvents_Sign(object sender, SignEventArgs e)
   // This event handler will run only in fully trusted form templates.

   Signature thisSignature = 

   // To add other pieces of information to sign, modify the
   // signature template returned by 
   // thisSignature.SignatureBlockXmlNode.
   // Write your code here.

   e.SignatureWizard = false;