# Events

> Connect event handlers to the Windows Forms TextControl, track unsaved changes with Changed and DocumentLoaded, find events by subject and override On methods.

- **Product:** TX Text Control .NET for Windows Forms
- **Section:** Documentation
- **Kind:** Topic
- **Path:** TX Text Control .NET for Windows Forms > Document Editor > Events
- **4114 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/events/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/events/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/events/llms-full.txt

---

Your application learns what happens in the editor through events: the user types, moves the caret, loads a file, clicks an image, adds a comment. The Windows Forms `TextControl` raises more than 140 events of its own, next to the usual events of a Windows Forms control such as `KeyDown` or `MouseWheel`. Find out how to connect handlers, which events belong to which subject and which events two common tasks, an unsaved-changes flag and a position display, are built from.

The examples use *Form1.cs* with a `TextControl` named `textControl1`, as created in [Create Your First Windows Forms Application](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/getting-started/document-editor/first-application/llms-full.txt).

### How the Events Work

The events of the `TextControl` are ordinary .NET events. A handler receives two parameters: `sender`, the `TextControl` that raised the event, and an event argument with the details:

- Events such as [Changed](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/changed-event/llms-full.txt), [InputPositionChanged](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/inputpositionchanged-event/llms-full.txt) or [PageChanged](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/pagechanged-event/llms-full.txt) pass a plain `EventArgs`. The handler reads what it needs from the control, for example the new [InputPosition](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/inputposition-property/llms-full.txt).
- Events about an object pass an argument class with that object, for example [TrackedChangeEventArgs](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/trackedchangeeventargs/llms-full.txt) with the tracked change, or [ImageEventArgs](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/imageeventargs/llms-full.txt) with the image.
- Some argument classes let the handler change what the editor does next, such as [CannotTrackChangeEventArgs](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/cannottrackchangeeventargs/llms-full.txt) with `Cancel` and `Handled`, or [HyphenateWordEventArgs](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/hyphenatewordeventargs/llms-full.txt) with the position at which a word is divided.

The reference page of each event names its argument class and describes when the event occurs.

### Connect an Event Handler

In the designer, select `textControl1` and click the **Events** button, the lightning bolt, in the **Properties** window. Double-click an event, and Visual Studio creates a handler such as `textControl1_Changed` in *Form1.cs* and connects it in *Form1.Designer.cs*.

In code, connect the handler with `+=`, for example in the constructor after `InitializeComponent`, and disconnect it with `-=` when it is no longer needed:

```csharp
public Form1()
{
    InitializeComponent();

    textControl1.Changed += textControl1_Changed;
    textControl1.DocumentLoaded += textControl1_DocumentLoaded;
}
```

### Track Unsaved Changes

A word processor asks before it closes a document with unsaved changes. [Changed](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/changed-event/llms-full.txt) occurs when the contents of the document have changed, [DocumentLoaded](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/documentloaded-event/llms-full.txt) when a new document has been loaded, and [ContentsReset](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/contentsreset-event/llms-full.txt) when all contents have been deleted and reset. A handler of `Changed` sets a modified flag, and the handlers of the other two, like your save code, clear it again. [Architecture and Control Lifecycle](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/architecture/#the-life-of-the-control) shows where these events occur in the life of a form, and [Load and Save Documents](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/getting-started/document-editor/load-save/llms-full.txt) builds the complete save-changes prompt.

### Show the Position of the Caret

[InputPositionChanged](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/inputpositionchanged-event/llms-full.txt) occurs whenever the input position changes, by typing, clicking or code; [Selections and Caret Position](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/editing-text/selections/#read-the-input-position) shows a handler that displays the page, line and column. For buttons of your own, [CharFormatChanged](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/charformatchanged-event/llms-full.txt) and [ParagraphFormatChanged](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/paragraphformatchanged-event/llms-full.txt) tell when the formatting at the input position or of the selection has changed, for example to check a bold button when [Selection.Bold](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/selection/bold-property/llms-full.txt) is `true`. The status bar of TX Text Control shows such information without code; see [Rulers and Status Bar](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/ribbon-ui/rulers-status-bar/llms-full.txt).

### Events by Subject

Many events come in families: an object is created, deleted, selected, clicked, moved or sized. The table lists the events by subject, with the page that describes them:

| Subject | Events | Read |
|---|---|---|
| Documents | [Changed](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/changed-event/llms-full.txt), [DocumentLoaded](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/documentloaded-event/llms-full.txt), [ContentsReset](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/contentsreset-event/llms-full.txt), [PageFormatChanged](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/pageformatchanged-event/llms-full.txt) | [Loading and Saving Documents](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/load-save/llms-full.txt) |
| Input position | [InputPositionChanged](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/inputpositionchanged-event/llms-full.txt), [InputParagraphChanged](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/inputparagraphchanged-event/llms-full.txt), [PageChanged](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/pagechanged-event/llms-full.txt), [SectionChanged](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/sectionchanged-event/llms-full.txt), [MainTextActivated](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/maintextactivated-event/llms-full.txt) | [Selections and Caret Position](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/editing-text/selections/llms-full.txt) |
| Formatting | [CharFormatChanged](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/charformatchanged-event/llms-full.txt), [ParagraphFormatChanged](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/paragraphformatchanged-event/llms-full.txt), [InputFormattingStyleChanged](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/inputformattingstylechanged-event/llms-full.txt), [FormattingStyleChanged](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/formattingstylechanged-event/llms-full.txt), [FormattingStyleListChanged](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/formattingstylelistchanged-event/llms-full.txt) | [Text and Paragraph Formatting](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/formatting/llms-full.txt), [Stylesheets](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/stylesheets/llms-full.txt) |
| Tables | [TableCreated](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/tablecreated-event/llms-full.txt), [TableDeleted](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/tabledeleted-event/llms-full.txt), [TableFormatChanged](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/tableformatchanged-event/llms-full.txt) | [Tables and Table Formulas](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/tables/llms-full.txt) |
| Images | [ImageCreated](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/imagecreated-event/llms-full.txt), [ImageClicked](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/imageclicked-event/llms-full.txt), [ImageSelected](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/imageselected-event/llms-full.txt) and the other `Image...` events | [Images](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/images/llms-full.txt) |
| Text frames and drawings | [TextFrameCreated](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/textframecreated-event/llms-full.txt), [TextFrameActivated](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/textframeactivated-event/llms-full.txt), [DrawingCreated](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/drawingcreated-event/llms-full.txt) and the other `TextFrame...` and `Drawing...` events | [Text Frames and Shapes](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/text-frames-shapes/llms-full.txt) |
| Charts and barcodes | [ChartCreated](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/chartcreated-event/llms-full.txt), [BarcodeCreated](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/barcodecreated-event/llms-full.txt) and the other `Chart...` and `Barcode...` events | [Charts and Barcodes](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/charts-barcodes/llms-full.txt) |
| All frames | [FrameClicked](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/frameclicked-event/llms-full.txt), [FrameSelected](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/frameselected-event/llms-full.txt), [FrameMoved](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/framemoved-event/llms-full.txt), [FrameSized](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/framesized-event/llms-full.txt) and the other `Frame...` events, for images, text frames, charts, barcodes and drawings alike | [Images](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/images/llms-full.txt) |
| Headers and footers | [HeaderFooterActivated](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/headerfooteractivated-event/llms-full.txt), [HeaderFooterDeactivated](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/headerfooterdeactivated-event/llms-full.txt) | [Headers and Footers](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/headers-footers/llms-full.txt) |
| Footnotes | [FootnoteCreated](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/footnotecreated-event/llms-full.txt), [FootnoteDeleted](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/footnotedeleted-event/llms-full.txt) and the other `Footnote...` events | [Footnotes](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/footnotes/llms-full.txt) |
| Tables of contents | [TableOfContentsCreated](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/tableofcontentscreated-event/llms-full.txt), [TableOfContentsEntered](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/tableofcontentsentered-event/llms-full.txt) and the other `TableOfContents...` events | [Tables of Contents](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/tables-of-contents/llms-full.txt) |
| Fields, links and bookmarks | [TextFieldClicked](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/textfieldclicked-event/llms-full.txt), [TextFieldEntered](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/textfieldentered-event/llms-full.txt), [HypertextLinkClicked](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/hypertextlinkclicked-event/llms-full.txt), [DocumentLinkClicked](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/documentlinkclicked-event/llms-full.txt), [DocumentTargetCreated](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/documenttargetcreated-event/llms-full.txt) and the other `TextField...` events | [Fields, Hyperlinks, and Bookmarks](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/fields/llms-full.txt) |
| Subtext parts | [SubTextPartCreated](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/subtextpartcreated-event/llms-full.txt), [SubTextPartEntered](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/subtextpartentered-event/llms-full.txt) and the other `SubTextPart...` events | [Subtext Parts](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/subtext-parts/llms-full.txt) |
| Form fields | [FormFieldTextChanged](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/formfieldtextchanged-event/llms-full.txt), [FormFieldCheckChanged](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/formfieldcheckchanged-event/llms-full.txt), [FormFieldSelectionChanged](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/formfieldselectionchanged-event/llms-full.txt), [FormFieldDateChanged](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/formfielddatechanged-event/llms-full.txt), [FormFieldSettingsChanged](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/formfieldsettingschanged-event/llms-full.txt) | [Form Fields and Conditional Instructions](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/form-fields/llms-full.txt) |
| Signature fields | [SignatureFieldCreated](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/signaturefieldcreated-event/llms-full.txt), [SignatureFieldClicked](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/signaturefieldclicked-event/llms-full.txt) and the other `SignatureField...` events | [Signature Fields](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/signature-fields/llms-full.txt) |
| Tracked changes | [TrackedChangeCreated](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/trackedchangecreated-event/llms-full.txt), [TrackedChangeDeleted](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/trackedchangedeleted-event/llms-full.txt), [TrackedChangeChanged](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/trackedchangechanged-event/llms-full.txt), [TrackedChangeStateChanged](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/trackedchangestatechanged-event/llms-full.txt), [CannotTrackChange](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/cannottrackchange-event/llms-full.txt) | [Track Changes](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/track-changes/llms-full.txt) |
| Comments | [CommentCreated](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/commentcreated-event/llms-full.txt), [CommentDeleted](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/commentdeleted-event/llms-full.txt), [CommentChanged](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/commentchanged-event/llms-full.txt), [CommentStateChanged](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/commentstatechanged-event/llms-full.txt), [CommentedTextEntered](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/commentedtextentered-event/llms-full.txt), [CommentedTextLeft](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/commentedtextleft-event/llms-full.txt) | [Comments](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/comments/llms-full.txt) |
| Editable regions | [EditableRegionCreated](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/editableregioncreated-event/llms-full.txt), [EditableRegionDeleted](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/editableregiondeleted-event/llms-full.txt), [EditableRegionEntered](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/editableregionentered-event/llms-full.txt), [EditableRegionLeft](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/editableregionleft-event/llms-full.txt) | [Document Protection and Editable Regions](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/protection/llms-full.txt) |
| Spelling and hyphenation | [SpellCheckText](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/spellchecktext-event/llms-full.txt), [HyphenateWord](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/hyphenateword-event/llms-full.txt) | [Spell Checking and Hyphenation](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/spell-checking/llms-full.txt) |
| View | [Zoomed](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/zoomed-event/llms-full.txt), [HScroll](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/hscroll-event/llms-full.txt), [VScroll](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/vscroll-event/llms-full.txt), [HExpanded](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/hexpanded-event/llms-full.txt), [VExpanded](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/vexpanded-event/llms-full.txt), [HShrunk](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/hshrunk-event/llms-full.txt), [VShrunk](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/vshrunk-event/llms-full.txt) | [Viewing, Zooming, and Navigation](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/viewing/llms-full.txt) |
| Menus and toolbars | [TextContextMenuOpening](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/textcontextmenuopening-event/llms-full.txt), [MiniToolbarOpening](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/minitoolbaropening-event/llms-full.txt), [TextMiniToolbarInitialized](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/textminitoolbarinitialized-event/llms-full.txt), [ObjectMiniToolbarInitialized](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/objectminitoolbarinitialized-event/llms-full.txt) | [Context Menus](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/ribbon-ui/context-menus/llms-full.txt), [Toolbars and Mini Toolbars](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/ribbon-ui/toolbars/llms-full.txt) |
| Fonts and XML | [AdaptFont](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/adaptfont-event/llms-full.txt), [XmlInvalid](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/xmlinvalid-event/llms-full.txt), [XmlNotWellFormed](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/xmlnotwellformed-event/llms-full.txt) | The reference pages of the events |

### Handle Events in a Derived Control

For every event, the `TextControl` has a protected method that raises it, named `On` and the event name, such as [OnChanged](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/reference/txtextcontrol/textcontrol/onchanged-method/llms-full.txt). A control derived from `TextControl` overrides the method to react before or after the handlers of the form. Call the base method, or the event is not raised:

```csharp
using System;
using TXTextControl;

public class AuditTextControl : TXTextControl.TextControl
{
    public DateTime LastChange { get; private set; }

    protected override void OnChanged(EventArgs e)
    {
        LastChange = DateTime.Now;

        // Raise the Changed event for the connected handlers
        base.OnChanged(e);
    }
}
```

### Next Steps

- [Architecture and Control Lifecycle](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/architecture/llms-full.txt): when the control is ready and in which order it is set up.
- [Selections and Caret Position](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/editing-text/selections/llms-full.txt): the input position that many events report.
- [Track Changes](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/track-changes/llms-full.txt) and [Comments](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/comments/llms-full.txt): events of a review workflow in use.
- [TextControl](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/overview/components/textcontrol/llms-full.txt): the properties, methods and events of the editor at a glance.

---

## Nearby

- **Previous:** [Right-to-Left UI](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-editor/ribbon-ui/right-to-left/llms-full.txt)
- **Next:** [Document Processing](https://docs.textcontrol.com/tx-text-control-dotnet-winforms/document-processing/llms-full.txt)
