articles

Home / DeveloperSection / Articles / NumericUpDown Control in VB.Net

NumericUpDown Control in VB.Net

NumericUpDown Control in VB.Net

Pushpendra Singh 42030 14-Dec-2010

NumericUpDown is basically countered that the user can input a number within the specified range. With the Help of NumericUpDown Control, we can enter numeric values, with advanced features like up-down buttons and accelerating auto-repeat.

How to use NumericUpDown Control

Drag and drop NumericUpDown Control from the toolbox on window Form.

NumericUpDown Control in VB.Net

Code:

Public Class Form12
    Private Sub NumericUpDown1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NumericUpDown1.ValueChanged
        'NumericUpDown valu will show in TextBox
        TextBox1.Text = NumericUpDown1.Value
    End Sub
End Class

 

By Default Maximum and Minimum value in NumericUpDown Control is set 100 and 0 respectively. You can also set Maximum and Minimum value in NumericUpDown Control. To show the value in NumericUpDown.

Run the project 

NumericUpDown Control in VB.Net

When you select the value in NumericUpDown1 then the ValueChanged event will fire and selected value will show in the TextBox.

NumericUpDown Control in VB.Net

 NumericUpDown Control Properties

DecimalPlaces:  Gets or sets the number of decimal places to display in NumericUpDown Control.

UpDownAlign:  Set positions the arrow buttons on the left or the right side of the NumericUpDown. Default value is Right.

Increment:  Gets or sets the value to increment or decrement the NumericUpDown.

Private Sub Form12_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Increment the NumericUpDown value
        NumericUpDown1.Increment = 5
End Sub

NumericUpDown value will be inrement 5 at each up button click.

NumericUpDown Control in VB.Net

Hexadecimal:   Hexadecimal property used to show value in Hexadecimal format in NumericUpDown. Default  value is false.

Private Sub Form12_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ' allow to show value Hexadecimal format
        NumericUpDown1.Hexadecimal = True
 End Sub


NumericUpDown Control in VB.Net 


Updated 04-Mar-2020

Leave Comment

Comments

Liked By