Skip to main content
A newer version of this page is available. .

How to: Create Check Box

The following example demonstrates how to create a check box in the Snap document.

  1. Call the IRichEditDocumentServer.LoadDocumentTemplate method to load the document template to the server.
  2. Enable the document modification by calling the SubDocument.BeginUpdate method.
  3. Create new SnapCheckBox instance by calling the ISnapFieldOwner.CreateSnCheckBox method. Pass the position to place the check box and the data field to which it corresponds to the method.
  4. Convert the check box field to a Snap field. To do that, call the ISnapFieldOwner.ParseField method. Note that if this step is skipped, you won’t be able to modify the check box.
  5. Start the checkbox modification by calling the SnapEntity.BeginUpdate method.
  6. Specify the check state by setting the SnapCheckBox.State property.
  7. To finalize the modification, call SnapEntity.EndUpdate method.
  8. Call the FieldCollection.Update method to update the check box field.
SnapCheckBox checkbox = server.Document.CreateSnCheckBox(server.Document.Range.Start, "Discontinued");
checkbox.State = System.Windows.Forms.CheckState.Checked;