Defines whether the event handler parsed the text.
Class: TextParsingEventArgs
Namespace: Softelvdm.SftDateNET
Assembly: Softelvdm.SftDateNET
public bool Handled { get; set; }
Public Property Handled As BooleanDefines whether the event handler parsed the text.
// 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);
}
private void sftDate2_ValueValidating(object sender, ValueValidatingEventArgs e) {
DumpValues("sftDate2.ValueValidating", e);
}
' 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)
End Sub
Private Sub SftDate2_ValueValidating(ByVal sender As Object, ByVal e As ValueValidatingEventArgs) Handles SftDate2.ValueValidating
DumpValues("SftDate2.ValueValidating", e)
End Sub
See Also TextParsingEventArgs Class | Classes | SftDate/NET 3.0