[Expand]General Information
[Collapse]WinForms Controls
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Property Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Chart Control
  [Expand]Map Control
  [Collapse]Rich Text Editor
   [Expand]Product Information
    Product Class Structure
    Supported Formats
   [Expand]Getting Started
   [Expand]RichEditControl Document
    Text Formatting
    Import and Export
   [Expand]Page Layout
    Spell Checking
    Mail Merge
    Restrictions and Protection
    Syntax Highlighting
   [Expand]Visual Elements
    Keyboard Shortcuts
    HTML Tag Support
    [Expand]Text Boxes
    [Collapse]Document Elements
      How to: Insert Bookmark or Hyperlink
      How to: Create, Edit and Delete Comments
      How to: Specify Document Properties
      How to: Create and Modify Header
      How to: Create a Checkbox
    [Expand]Search and Replace
    [Expand]Mail Merge
    [Expand]Spell Check
    [Expand]Import and Export
    [Expand]User Interface Customization
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Sunburst Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

How to: Create a Checkbox

Follow the steps below to create a CheckBox object in code:

  1. Access the document's form fields collection using the SubDocument.FormFields property and call the FormFieldCollection.InsertCheckBox method to create a CheckBox object at the specified document position. In the example below, the checkbox is created at the caret's position.


    Checkboxes cannot be inserted to the document header, footer, comments or floating objects (text boxes or shapes). Otherwise, an FormFieldIncorrectSubDocumentException occurs.

  2. Define the name of the bookmark associated with the current CheckBox object using the FormField.Name property.
  3. Specify the checkbox's state using the CheckBox.State property.
  4. Use the CheckBox.SizeMode property to define the checkbox's size. Selecting the CheckBoxSizeMode.Auto mode resizes the checkbox according to the current font size value (returned by the CharacterPropertiesBase.FontSize property). Set the SizeMode property to CheckBoxSizeMode.Exact and specify the CheckBox.Size value to specify the checkbox's size.
  5. You can add instructional text to the checkbox. This text can be displayed in the status bar or when focusing the checkbox and pressing F1. Specify the help text type and the text using the following members:

    When setting the HelpTextType or StatusTextType property to FormFieldTextType.Auto, make sure that the provided HelpText or StatusText value is equal to one of the AutoText gallery's entries (stored as the Normal.dotm file in the system's Templates folder). Otherwise, the help text is not displayed.


    Currently, the RichEditControl cannot display any instructional text.

  6. Set the FormField.CalculateOnExit property to true to update the checkbox's value on exit.

The following code sample shows how to create a checkbox on a caret's position:

Expanded See Also

Is this topic helpful?​​​​​​​