HeaderPane
Main
Hide
Share Link
Print

UpDownPress Event, SftMask Class

Occurs when an up or down button is pressed or the Up or Down key is used in a numeric field with spinning.

Class: SftMask
Namespace: Softelvdm.SftMaskNET
Assembly: Softelvdm.SftMaskNET

Syntax

public event EventHandler<UpDownPressEventArgs> UpDownPress;
Public Event UpDownPress As EventHandler(Of UpDownPressEventArgs)

Comments

Occurs when an up or down button is pressed or the Up or Down key is used in a numeric field with spinning.

While a button is held down, the event occurs every 100 milliseconds, and with each repeat of a key held down (UpDownPressEventArgs.Counter). The SftMask.SpinUp and SftMask.SpinDown methods raise it too. Setting UpDownPressEventArgs.FieldText or Handled replaces the control's own step (SftMask.SpinIncrement property).

Examples

C# View entire sample code

        // Amounts over 10,000 are not accepted.
        private void sftMask1_CustomValidation(object sender, CancelEventArgs e) {
            e.Cancel = sftMask1.Value.HasValue && sftMask1.Value.Value > 10000;
            DumpValues("sftMask1.CustomValidation" + (e.Cancel ? " (over 10,000, refused)" : ""), e);
        }

        private void sftMask1_UpDownPress(object sender, UpDownPressEventArgs e) {
            DumpValues("sftMask1.UpDownPress", e);
        }

        private void sftMask1_CalculatorOpening(object sender, CalculatorOpeningEventArgs e) {
            e.Cancel = checkBlock.Checked;
            DumpValues("sftMask1.CalculatorOpening" + (e.Cancel ? " (canceled)" : ""), e);
        }

        private void sftMask1_DropDownOpened(object sender, DropDownEventArgs e) {

VB.NET View entire sample code

    End Sub

    ' Amounts over 10,000 are not accepted.
    Private Sub SftMask1_CustomValidation(ByVal sender As Object, ByVal e As CancelEventArgs) Handles SftMask1.CustomValidation
        e.Cancel = SftMask1.Value.HasValue AndAlso SftMask1.Value.Value > 10000
        DumpValues("SftMask1.CustomValidation" + If(e.Cancel, " (over 10,000, refused)", ""), e)
    End Sub

    Private Sub SftMask1_UpDownPress(ByVal sender As Object, ByVal e As UpDownPressEventArgs) Handles SftMask1.UpDownPress
        DumpValues("SftMask1.UpDownPress", e)
    End Sub

    Private Sub SftMask1_CalculatorOpening(ByVal sender As Object, ByVal e As CalculatorOpeningEventArgs) Handles SftMask1.CalculatorOpening
        e.Cancel = CheckBlock.Checked
        DumpValues("SftMask1.CalculatorOpening" + If(e.Cancel, " (canceled)", ""), e)
    End Sub

See Also SftMask Class | Classes | SftMask/NET 3.0