NumericUpDown in Visual Basic .NET

Tags: VB.NET, VB 2008, VB 2010, VB 2012, VB 2013

This lesson describes the NumericUpDown control


NumericUpDown

This control displays a number with up and down arrows that change the value.

If you click an arrow and hold it down, the number changes repeatedly, and after a while, the changes go even faster, so you can make some fairly large changes in a short period.

example

The number can be also changed by clicking the control and typing in a new value.

You can use the Increment property to set the amount by which the values are modified when the user clicks an arrow.

properties

Its event, ValueChanged, fires whenever the control's value changes, and it fires when the user changes it as well as when your program's code changes it.

    Private Sub NumericUpDown1_ValueChanged(sender As Object, e As EventArgs) _
        Handles NumericUpDown1.ValueChanged
        ' ToDo: something
    End Sub


Finally to get the numeric value you use the NumericUpDown control's Value property:

Private Sub NextButton_Click(sender As Object, e As EventArgs) Handles NextButton.Click
    Dim preferedvalue As Decimal = NumericUpDown1.Value
    ' ToDo: something
End Sub

Previous Lesson | Next Lesson


Share This

Subscribe

More Tutorials

Popular

Home | About | Contact | Privacy Policy

Copyright visual-basic-tutorials.com 2017 - All Rights Reserved.