Extending the InfoPath control set with custom controls

InfoPath provides a rich and complete set of generic built-in controls in both 1.0 and SP-1, but there are some cases where there is a need for a control that is specific to your form or to your organization.  InfoPath SP-1 provides functionality to let users extend the set of controls available. Form developers can leverage currently existing ActiveX controls and use them within InfoPath. Also, following a few prescribed steps, software developers can write their own ActiveX controls to be used in InfoPath.

InfoPath’s custom control support allows users to create controls for three different types of binding:

Simple data type (string, numbers, etc)

Controls that are written to bind to simple data types would allow a control to do custom processing on data before it gets put into the XML. The control can be designed to have UI that combines multiple simple controls (buttons, textboxes, checkboxes, etc…) to encapsulate them into one control. For example, multiple buttons can be combined with a textbox to make an in-document calculator control. Combining these all into one control will provide a simple way to re-use the same control in multiple forms.

XML stream

InfoPath SP-1 allows XML nodes to follow any schema. This allows form developers to work with industry standard XML Schemas. One example is a MathML control that could be written for InfoPath to save XML compliant with the MathML schema and display it in InfoPath form in a meaningful manner.


For greater flexibility, InfoPath custom controls can be bound to an IXMLDomNode and any msxml operations can be performed directly on the XML tree.


Custom controls need not be installed on every form users’ computer before loading the form. Controls can be packaged with your form solution so that on first open, the control will be registered and installed. Controls should be stored in a CAB files and able to self-register.


Custom controls in InfoPath have a few security constraints to keep users safe. Firstly, all custom controls used within InfoPath require the IObjectSafety interface to be implemented and the control to be marked as Safe for Scripting and Safe for Initialization. Without these two flags, InfoPath will not load the form and will notify the user.

In addition, for solution which have controls packaged in the form solution, it is necessary to sign the CAB files with a digital signature. When users open the form for the first time, they will be prompted on whether or not they will accept the control signed with that signature (similar to the ActiveX control dialogs you see in Windows 2k/XP).

For detailed information on how to write a custom control for InfoPath, see Lab 06 in the MSDN InfoPath 2003 Training. (http://msdn.microsoft.com/library/en-us/odc_ip2003_tr/html/odc_INF_Lab_06.asp)


Comments (7)

  1. Brian Mains says:

    I seem to be forever having problems with Custom Controls. Here is some of my scenarios:

    1. Everytime I opened a project with a custom control that used a type converter, it said "Error Creating Control", and I deleted/added it and it worked fine.

    2. Sometimes making some minor changes (I researched and it appeared fine) to a control then recompiled the project, I got "Error Creating Control." I deleted it and added it again, dropped the reference and added it, etc. and it still said that.

    Has anyone else had the amount of problems with custom controls? I consider just dropping them and copying/pasting code because it feels like more of a hassle trying to get them to work than to manually create the code.

    Anybody have comments/thoughts about this?

  2. Scott Roberts [MSFT] says:

    Hi Brian,

    We are interested and trying to reproduce the problem you are having. However, we’re not sure what you mean by a type converter exactly. Can you explain? Are you using Visual C++, Visual Basic, Visual C#, or some other language?

    Also, have you posted your questions to the InfoPath newsgroup?

  3. Dragon-China says:



  4. Arakazu says:

    I can’t add ActiveX custom control to my form. Sorry to ask you very stupid questions, but how can I install those?? Should I re-install the InfoPath or another way???

    Please advies.

Skip to main content