Provides data for the SftDate.TextParsing event, raised before a text typed or pasted by the user is parsed.
An event handler that understands the text (for example "+7" or "next friday") sets Value and Handled. Setting Handled with a null Value rejects the text.
Namespace: Softelvdm.SftDateNET
Assembly: Softelvdm.SftDateNET
Inheritance
public class TextParsingEventArgs : System.EventArgs;
Public Class TextParsingEventArgs
Inherits System.EventArgsThis class cannot be instantiated.
![]() | CurrentValue | Returns the value before the text was entered. |
![]() | Handled | Defines whether the event handler parsed the text. |
![]() | Text | Returns the text to parse. |
![]() | Value | Defines the value the text represents. |
![]() ![]() ![]() | Empty | Provides a value to use with events that do not have event data. |
![]() ![]() | Equals | Determines whether the specified object is equal to the current object. |
![]() ![]() | Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. |
![]() ![]() | GetHashCode | Serves as the default hash function. |
![]() ![]() | GetType | Gets the Type of the current instance. |
![]() ![]() | MemberwiseClone | Creates a shallow copy of the current Object. |
![]() ![]() ![]() | ReferenceEquals | Determines whether the specified Object instances are the same instance. |
![]() ![]() | ToString | Returns a string that represents the current object. |
}
private void sftDate1_KeyDown(object sender, KeyEventArgs e) {
DumpValues("sftDate1.KeyDown", e);
}
// sftDate2 - a free-form field; besides dates in the culture's format it accepts +n and -n days from today
private void sftDate2_TextParsing(object sender, TextParsingEventArgs e) {
Match m = Regex.Match(e.Text.Trim(), @"^([+-])\s*(\d{1,4})$");
if (m.Success) {
int days = int.Parse(m.Groups[2].Value);
e.Value = DateTime.Today.AddDays(m.Groups[1].Value == "-" ? -days : days);
e.Handled = true;
}
DumpValues("sftDate2.TextParsing", e);
End Sub
Private Sub SftDate1_KeyDown(ByVal sender As Object, ByVal e As KeyEventArgs) Handles SftDate1.KeyDown
DumpValues("SftDate1.KeyDown", e)
End Sub
' SftDate2 - a free-form field; besides dates in the culture's format it accepts +n and -n days from today
Private Sub SftDate2_TextParsing(ByVal sender As Object, ByVal e As TextParsingEventArgs) Handles SftDate2.TextParsing
Dim m As Match = Regex.Match(e.Text.Trim(), "^([+-])\s*(\d{1,4})$")
If m.Success Then
Dim days As Integer = Integer.Parse(m.Groups(2).Value)
e.Value = DateTime.Today.AddDays(If(m.Groups(1).Value = "-", -days, days))
e.Handled = True
End If
DumpValues("SftDate2.TextParsing", e)See Also Classes | SftDate/NET 3.0