HeaderPane
Main
Hide
Share Link
Print

NewValue Property, ValueValidatingEventArgs Class

Defines the new value, or null for an empty field.

Class: ValueValidatingEventArgs
Namespace: Softelvdm.SftDateNET
Assembly: Softelvdm.SftDateNET

Syntax

public DateTime? NewValue { get; set; }
Public Property NewValue As DateTime?

Value

Comments

Defines the new value, or null for an empty field.

Examples

C# View entire sample code

            listView1.Items.Clear();
            strLastEvent = "";
            fLastEventDup = false;
        }

        // sftDate1 - a date and time field; appointments are only accepted on weekdays

        private void sftDate1_ValueValidating(object sender, ValueValidatingEventArgs e) {
            if (e.NewValue.HasValue && (e.NewValue.Value.DayOfWeek == DayOfWeek.Saturday || e.NewValue.Value.DayOfWeek == DayOfWeek.Sunday)) {
                e.Cancel = true;
                DumpValues("sftDate1.ValueValidating (canceled, a weekend)", e);
            } else
                DumpValues("sftDate1.ValueValidating", e);
        }

        private void sftDate1_ValueChanged(object sender, EventArgs e) {

VB.NET View entire sample code

        ListView1.Items.Clear()
        strLastEvent = ""
        fLastEventDup = False
    End Sub

    ' SftDate1 - a date and time field; appointments are only accepted on weekdays

    Private Sub SftDate1_ValueValidating(ByVal sender As Object, ByVal e As ValueValidatingEventArgs) Handles SftDate1.ValueValidating
        If e.NewValue.HasValue AndAlso (e.NewValue.Value.DayOfWeek = DayOfWeek.Saturday OrElse e.NewValue.Value.DayOfWeek = DayOfWeek.Sunday) Then
            e.Cancel = True
            DumpValues("SftDate1.ValueValidating (canceled, a weekend)", e)
        Else
            DumpValues("SftDate1.ValueValidating", e)
        End If
    End Sub

See Also ValueValidatingEventArgs Class | Classes | SftDate/NET 3.0