HeaderPane
Main
Hide
Share Link
Print

ValueValidatingEventArgs Class

Provides data for the SftDate.ValueValidating event, raised before a value entered by the user is accepted.

An event handler can change the new value or cancel the change, which restores the previous value.

Namespace: Softelvdm.SftDateNET
Assembly: Softelvdm.SftDateNET

Inheritance

Syntax

public class ValueValidatingEventArgs : System.ComponentModel.CancelEventArgs;
Public Class ValueValidatingEventArgs
    Inherits System.ComponentModel.CancelEventArgs

Constructors

This class cannot be instantiated.

Properties

PublicInherited from System.ComponentModel.CancelEventArgsCancelGets or sets a value indicating whether the event should be canceled.
PublicNewRangeEndDefines the new last date of a range.
PublicNewValueDefines the new value, or null for an empty field.

Fields

PublicStaticInherited from System.EventArgsEmptyProvides a value to use with events that do not have event data.

Methods

PublicInherited from System.ObjectEqualsDetermines whether the specified object is equal to the current object.
ProtectedInherited from System.ObjectFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
PublicInherited from System.ObjectGetHashCodeServes as the default hash function.
PublicInherited from System.ObjectGetTypeGets the Type of the current instance.
ProtectedInherited from System.ObjectMemberwiseCloneCreates a shallow copy of the current Object.
PublicStaticInherited from System.ObjectReferenceEqualsDetermines whether the specified Object instances are the same instance.
PublicInherited from System.ObjectToStringReturns a string that represents the current object.

Examples

C# View entire sample code

        private void buttonClear_Click(object sender, EventArgs e) {
            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);
        }

VB.NET View entire sample code

    Private Sub ButtonClear_Click(ByVal sender As Object, ByVal e As EventArgs) Handles ButtonClear.Click
        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 Classes | SftDate/NET 3.0