Creating a Custom Button Using Custom Code

In InfoPath, you can create a custom button using your own custom software code. To create a custom button using code:

Submit

To create a button that will submit an InfoPath form and close the form, include the following line in your code:

NotifyHost("Submit&Close");

Cancel

To create a button that will close an InfoPath form without submitting the form, include the following line in your code:

NotifyHost("Close");