Example with NumericUpDown:-




Add a new Form i.e.,FormNumericUpDown to the Windows Application WABasics

Create two labels,one textbox and one NumericUpDown Control & set the following properties to them

label1:-
     Text      :         Select Any Number
     Name     :         lblSelectNumber

textBox1:-
     Name     :         txtSample

dateTimePicker1:-

Name          :         numSample


Design :-



 Generate theEventHandler for numericUpDown1  ValueChanged Event
& write the following code in Source[FormNumericUpDown.cs] 

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WABasics
{
    public partial class FormNumericUpDown : Form
    {
        public FormNumericUpDown()
        {
            InitializeComponent();
        }

        private void numSample_ValueChanged(object sender, EventArgs e)
        {
            txtSample.Text = numSample.Value.ToString();
        }
    }
}



Result :-


No comments:

Post a Comment