Export (0) Print
Expand All
1 out of 2 rated this helpful - Rate this topic

Word Dynamic Controls Sample

NoteNote:

This sample runs only in Microsoft Office Word 2007.

When you do not know at design time how many controls will be required in a document at run time, you can add controls dynamically in response to events.

This sample demonstrates how to add and remove Windows Forms controls and host controls.

Security noteSecurity Note:

This sample code is intended to illustrate a concept, and it shows only the code that is relevant to that concept. It may not meet the security requirements for a specific environment, and it should not be used exactly as shown. We recommend that you add security and error-handling code to make your projects more secure and robust. Microsoft provides this sample code "AS IS" with no warranties.

To run this sample

  1. Press F5.

  2. Place the insertion point in the document and then select a check box in the actions pane.

    A control is added at the insertion point.

  3. Clear the check box that you selected.

    The control is removed from the document.

  • Dynamically placing Windows Forms controls and host controls at the insertion point on a document.

  • Dynamically removing Windows Forms controls and host controls from a document.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.