Click here to Skip to main content
15,886,578 members
Articles / Web Development / HTML

Extended NumericUpDown Control

Rate me:
Please Sign up or sign in to vote.
4.89/5 (36 votes)
23 Sep 2020CPOL5 min read 256.6K   2.8K   124  
An extended NumericUpDown control with better focus and mouse wheel management.
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class frmDemo
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        Try
            If disposing AndAlso components IsNot Nothing Then
                components.Dispose()
            End If
        Finally
            MyBase.Dispose(disposing)
        End Try
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.NumericUpDown1 = New System.Windows.Forms.NumericUpDown
        Me.Label1 = New System.Windows.Forms.Label
        Me.Label2 = New System.Windows.Forms.Label
        Me.PropertyGrid1 = New System.Windows.Forms.PropertyGrid
        Me.Label3 = New System.Windows.Forms.Label
        Me.NumericUpDownEx1 = New CoolSoft.UI.NumericUpDownEx
        CType(Me.NumericUpDown1, System.ComponentModel.ISupportInitialize).BeginInit()
        CType(Me.NumericUpDownEx1, System.ComponentModel.ISupportInitialize).BeginInit()
        Me.SuspendLayout()
        '
        'NumericUpDown1
        '
        Me.NumericUpDown1.Location = New System.Drawing.Point(12, 82)
        Me.NumericUpDown1.Name = "NumericUpDown1"
        Me.NumericUpDown1.Size = New System.Drawing.Size(120, 22)
        Me.NumericUpDown1.TabIndex = 3
        '
        'Label1
        '
        Me.Label1.AutoSize = True
        Me.Label1.Location = New System.Drawing.Point(12, 62)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(113, 17)
        Me.Label1.TabIndex = 2
        Me.Label1.Text = "NumericUpDown"
        '
        'Label2
        '
        Me.Label2.AutoSize = True
        Me.Label2.Location = New System.Drawing.Point(12, 131)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(128, 17)
        Me.Label2.TabIndex = 4
        Me.Label2.Text = "NumericUpDownEx"
        '
        'PropertyGrid1
        '
        Me.PropertyGrid1.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
                    Or System.Windows.Forms.AnchorStyles.Left) _
                    Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.PropertyGrid1.Location = New System.Drawing.Point(188, 12)
        Me.PropertyGrid1.Name = "PropertyGrid1"
        Me.PropertyGrid1.Size = New System.Drawing.Size(416, 542)
        Me.PropertyGrid1.TabIndex = 0
        '
        'Label3
        '
        Me.Label3.Location = New System.Drawing.Point(12, 12)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(154, 50)
        Me.Label3.TabIndex = 1
        Me.Label3.Text = "Select a control to see its properties."
        '
        'NumericUpDownEx1
        '
        Me.NumericUpDownEx1.AutoSelect = True
        Me.NumericUpDownEx1.InterceptMouseWheel = CoolSoft.UI.NumericUpDownEx.InterceptMouseWheelMode.Never
        Me.NumericUpDownEx1.Location = New System.Drawing.Point(12, 151)
        Me.NumericUpDownEx1.Name = "NumericUpDownEx1"
        Me.NumericUpDownEx1.ShowUpDownButtons = CoolSoft.UI.NumericUpDownEx.ShowUpDownButtonsMode.WhenMouseOver
        Me.NumericUpDownEx1.Size = New System.Drawing.Size(120, 22)
        Me.NumericUpDownEx1.TabIndex = 5
        '
        'frmDemo
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(8.0!, 16.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.ClientSize = New System.Drawing.Size(616, 566)
        Me.Controls.Add(Me.Label2)
        Me.Controls.Add(Me.Label3)
        Me.Controls.Add(Me.Label1)
        Me.Controls.Add(Me.NumericUpDown1)
        Me.Controls.Add(Me.PropertyGrid1)
        Me.Controls.Add(Me.NumericUpDownEx1)
        Me.Name = "frmDemo"
        Me.Text = "Test form"
        CType(Me.NumericUpDown1, System.ComponentModel.ISupportInitialize).EndInit()
        CType(Me.NumericUpDownEx1, System.ComponentModel.ISupportInitialize).EndInit()
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub
    Friend WithEvents NumericUpDownEx1 As CoolSoft.UI.NumericUpDownEx
    Friend WithEvents PropertyGrid1 As System.Windows.Forms.PropertyGrid
    Friend WithEvents NumericUpDown1 As System.Windows.Forms.NumericUpDown
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents Label3 As System.Windows.Forms.Label

End Class

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Technical Lead CoolSoft
Italy Italy
I started programming in the early 1984, when I was 12, using each and every version of VB, from QuickBasic (1985) to VB.NET 11.0, but also C#, C++, PHP, JavaScript, Fortran, Pascal, Modula2, together with a lot of frameworks like Symfony, jQuery, Drupal.

My most popular project is VirtualMIDISynth, a software MIDI synthesizer (using .sf2 soundfont files) implemented as a virtual device driver. It works on all modern Windows OS from XP to 8, both 32 and 64 bit.

Another project of mine is DeCodEx (DEsigner CODe EXtractor), a free tool to split VisualStudio 2003 forms and controls source code into the new 2005/2008 partial classes format (*.vb and *.Designer.vb, or *.cs and *.Designer.cs).

I like writing tools to make my seveloper and SysAdmin life easier.

You can find them here: http://coolsoft.altervista.org.

Comments and Discussions