ValueChanging Event

Measurement Studio User Interface

ValueChanging Event

Syntax

Sub ControlName_ValueChanging( NewValue As Variant, AttemptedValue As Variant, PreviousValue As Variant, OutOfRange As Boolean)

Applies To

CWNumEdit

Purpose

Generated when the value of the CWNumEdit control is about to change (the value of the control has been entered but not set).

Remarks

Modify the NewValue parameter within your event handler to change the value that will be set in the numeric edit control.

Parameters

NewValue As Variant

Specifies the new value the control will have. If you alter the NewValue parameter within your event code, the CWNumEdit control will take on the altered NewValue.

AttemptedValue As Variant

Specifies the value the user tried to set into the control. This value is often the same as NewValue and is most useful for custom range checking or validation.

PreviousValue As Variant

Specifies the value of the CWNumEdit control before the value changed.

OutOfRange As Boolean

True if NewValue is not within the range specified by the Minimum and Maximum properties.

Example

Sub CWNumEdit1_ValueChanging(NewValue as Variant, ByVal AttemptedValue as Variant, ByVal PreviousValue as Variant, ByVal OutOfRange as Boolean)
    'If the new value is outside the range 0-100
    If NewValue < 0 or NewValue > 100 Then
        'Set the value to 50
        NewValue = 50
    End If
End Sub

See Also

ValueChanged

SetMinMax