Arguments for events that handle when text is about to change, such as the TextBox.TextChanging event.
Remarks: To cancel the change, set the inherited CancelEventArgs.Cancel property to true.

Constructors

TextChangingEventArgs

#
public TextChangingEventArgs(string oldText, string newText, bool fromUser)
Initializes a new instance of the TextChangingEventArgs class.
oldText (string)Old text for the control
newText (string)New text for the control
fromUser (bool)Value indicating that the change was initiated from the user

TextChangingEventArgs

#Since v2.12
public TextChangingEventArgs(string oldText, string newText, TextChangeSource source)
Initializes a new instance of the TextChangingEventArgs class.
oldText (string)Old text for the control
newText (string)New text for the control
source (TextChangeSource)Value indicating how the change was initiated.

TextChangingEventArgs

#
public TextChangingEventArgs(string text, Range<int> range, bool fromUser)
Initializes a new instance of the TextChangingEventArgs class.
text (string)Text to be replaced in the range.
range (Range<int>)Range of text to be effected.
fromUser (bool)Value indicating that the change was initiated from the user

TextChangingEventArgs

#
public TextChangingEventArgs(string text, Range<int> range, string oldText, bool fromUser)
Initializes a new instance of the TextChangingEventArgs class.
text (string)Text to be replaced in the range.
range (Range<int>)Range of text to be effected.
oldText (string)Current text in the control.
fromUser (bool)Value indicating that the change was initiated from the user

TextChangingEventArgs

#Since v2.12
public TextChangingEventArgs(string text, Range<int> range, string oldText, TextChangeSource source)
Initializes a new instance of the TextChangingEventArgs class.
text (string)Text to be replaced in the range.
range (Range<int>)Range of text to be effected.
oldText (string)Current text in the control.
source (TextChangeSource)Value indicating how the change was initiated.

TextChangingEventArgs

#Since v2.12
public TextChangingEventArgs(string text, Range<int> range, TextChangeSource source)
Initializes a new instance of the TextChangingEventArgs class.
text (string)Text to be replaced in the range.
range (Range<int>)Range of text to be effected.
source (TextChangeSource)Value indicating how the change was initiated.

Properties

FromUser

#
public bool FromUser { get; }
Gets a value indicating that the change was initiated by the user, false when the change was made programmatically.
Remarks: This is a convenience that returns true for any Source other than TextChangeSource.Programmatic. Use Source to determine how the user initiated the change (typing, paste, etc.).

NewText

#
public string NewText { get; }
Gets the new text the control will contain after the change.

OldText

#
public string OldText { get; }
Gets the entire old text for the control.

Range

#
public Range<int> Range { get; }
Gets the range that the text will be replaced or deleted.
Remarks: When the Text is empty, then the specified range of text will be deleted. Otherwise, the text in the range will be replaced. Note that the length of the Text will not necessarily match the length of the range.
The range.

Source

#Since v2.12
public TextChangeSource Source { get; }
Gets a value indicating how the change was initiated, e.g. by typing, pasting, or programmatically.

Text

#
public string Text { get; }
Gets the text that is to be inserted at the given Range, or string.Empty if text will be deleted.