Logo

Navigation
  • Home
  • Services
    • ERP Solutions
    • Implementation Solutions
    • Support and Maintenance Solutions
    • Custom Solutions
    • Upgrade Solutions
    • Training and Mentoring
    • Web Solutions
    • Production Support
    • Architecture Designing
    • Independent Validation and Testing Services
    • Infrastructure Management
  • Expertise
    • Microsoft Development Expertise
    • Mobile Development
    • SQL Server Database and BI
    • SAP BI, SAP Hana, SAP BO
    • Oracle and BI
    • Oracle RAC
  • Technical Training
    • Learn Data Management
      • Business Intelligence
      • Data Mining
      • Data Modeling
      • Data Warehousing
      • Disaster Recovery
    • Learn Concepts
      • Application Development
      • Client Server
      • Cloud Computing Tutorials
      • Cluster Computing
      • CRM Tutorial
      • EDI Tutorials
      • ERP Tutorials
      • NLP
      • OOPS
      • Concepts
      • SOA Tutorial
      • Supply Chain
      • Technology Trends
      • UML
      • Virtualization
      • Web 2.0
    • Learn Java
      • JavaScript Tutorial
      • JSP Tutorials
      • J2EE
    • Learn Microsoft
      • MSAS
      • ASP.NET
      • ASP.NET 2.0
      • C Sharp
      • MS Project Training
      • Silverlight
      • SQL Server 2005
      • VB.NET 2005
    • Learn Networking
      • Networking
      • Wireless
    • Learn Oracle
      • Oracle 10g
      • PL/SQL
      • Oracle 11g Tutorials
      • Oracle 9i
      • Oracle Apps
    • Learn Programming
      • Ajax Tutorial
      • C Language
      • C++ Tutorials
      • CSS Tutorial
      • CSS3 Tutorial
      • JavaScript Tutorial
      • jQuery Tutorial
      • MainFrame
      • PHP Tutorial
      • VBScript Tutorial
      • XML Tutorial
    • Learn Software Testing
      • Software Testing Types
      • SQA
      • Testing
  • Career Training
    • Career Improvement
      • Career Articles
      • Certification Articles
      • Conflict Management
      • Core Skills
      • Decision Making
      • Entrepreneurship
      • Goal Setting
      • Life Skills
      • Performance Development
      • Personal Excellence
      • Personality Development
      • Problem Solving
      • Relationship Management
      • Self Confidence
      • Self Supervision
      • Social Networking
      • Strategic Planning
      • Time Management
    • Education Help
      • Career Tracks
      • Essay Writing
      • Internship Tips
      • Online Education
      • Scholarships
      • Student Loans
    • Managerial Skills
      • Business Communication
      • Business Networking
      • Facilitator Skills
      • Managing Change
      • Marketing Management
      • Meeting Management
      • Process Management
      • Project Management
      • Project Management Life Cycle
      • Project Management Process
      • Project Risk Management
      • Relationship Management
      • Task Management
      • Team Building
      • Virtual Team Management
    • Essential Life Skills
      • Anger Management
      • Anxiety Management
      • Attitude Development
      • Coaching and Mentoring
      • Emotional Intelligence
      • Stress Management
      • Positive Thinking
    • Communication Skills
      • Conversation Skills
      • Cross Culture Competence
      • English Vocabulary
      • Listening Skills
      • Public Speaking Skills
      • Questioning Skills
    • Soft Skills
      • Assertive Skills
      • Influence Skills
      • Leadership Skills
      • Memory Skills
      • People Skills
      • Presentation Skills
    • Finding a Job
      • Etiquette Tips
      • Group Discussions
      • HR Interviews
      • Interview Notes
      • Job Search Tips
      • Resume Tips
      • Sample Resumes
 

DomainUpDown and NumericUpDown Controls

By Exforsys | on June 27, 2005 |
VB.NET 2005

DomainUpDown and NumericUpDown Controls

DomaiUpDown

The windows Forms System.Windows.DomainUpDown control looks like a combination of a text box and a pair of buttons for moving up or down through a list. This control displays and sets a text string from a list of choices.

You can select the string by clicking up and down buttons to navigate through a list. Alternatively you can press the UP and DOWN Arrow keys or just type a string that matches an item in the list. You can use this control to select items from an alphabetically sorted list of names. This controls functions like ListBox but it takes up less space comparatively.

We shall look at an example that instantiates an object of DomainUpDown Control programmatically and add values to it.

1. In Visual Basic express start a new Windows Project and give a name as DomainUpDownDemo.

2. Add a text box, a CheckBox and two Buttons.

3. Now add the following code to the form.

Public Class Form1

Protected WithEvents domainUpDown1 As DomainUpDown

Private myCounter As Integer = 1

Private Sub MySub()

domainUpDown1 = New System.Windows.Forms.DomainUpDown()

Controls.Add(domainUpDown1)

End Sub

Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

domainUpDown1.Items.Add((TextBox1.Text.Trim() & " – " & myCounter))

myCounter = myCounter + 1

TextBox1.Text = ""

End Sub

Private Sub checkBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged

If domainUpDown1.Sorted Then

domainUpDown1.Sorted = False

Else

domainUpDown1.Sorted = True

End If

End Sub

Private Sub domainUpDown1_SelectedItemChanged _

(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles domainUpDown1.SelectedItemChanged

MessageBox.Show(("SelectedIndex: " & domainUpDown1.SelectedIndex.ToString() & _

ControlChars.Cr & "SelectedItem: " & domainUpDown1.SelectedItem.ToString()))

End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

MySub()

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

Me.Close()

End Sub

End Class

In the above code you have declared the domainUpDown1 as a variable of DomainUpDown class. In MySub procedure we are instantiating the control with the key word new. The statement “Control.Add(domainUpDown1)” adds the control to the form.

The Button1 Click event reads the value from TextBox, appends a number to it and adds the string to the domainUpDown1 object. Press F5 to execute the program. This following window will be shown. Type values into the TextBox and click the button “Add Strings” to add the values to the domainUpDown1 object.

The event handler for the donainUpDown1 object gives the message box that is shown below:

This control can be used in the place of the ListBox control where less space is needed.

NumericUpDown

This Windows Forms System.Windows.Forms.NumericUpDown control looks like a combination of a text box and a pair of arrows that the user can click to adjust a value. The control displays and sets a single numeric value from a list of choices.

The user can increment and decrement the number by clicking up and down buttons, by pressing the UP and DOWN ARROW keys, or by typing a number. Clicking the UP ARROW key moves the value toward the maximum; clicking the DOWN ARROW key moves the value toward the minimum. An example where this kind of control might be useful is for a volume control on a music player. Numeric up-down controls are used in many Windows control panel applications.

The following Demo illustrates the use of this control.

1. In the Visual Studio IDE create a new windows project and give the name NumericUpDownDemo.

2. To the Form1 add a NumericUpdownControl, a list box and a button.

3. Right click the form and choose View Codes from the context sensitive menu.

4. Now add the following codes to the Form1.

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Me.Close()

End Sub

Private Sub NumericUpDown1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NumericUpDown1.ValueChanged

Label1.Text = "The current Value of the counter is : " & NumericUpDown1.Value

End Sub

End Class

Press F5 to execute the program. When you click the UP and Down Arrow in the NumricUpDown1 object, the text on the Label will show the value of the counter. This is shown in the screen shot below:

You can also set the number of decimal places that will appear after the decimal point. The default is zero. You can also set the thousands separator. This control can also be set up to display hexadecimal value by setting the value of System.Windows.Forms.NumericUpDown.Hexadecimal property true.

« « How to Install and Use NetBeans for Java Development
Career Track: Database Administrator » »

Author Description

Avatar

Editorial Team at Exforsys is a team of IT Consulting and Training team led by Chandra Vennapoosa.

Free Training

RSSSubscribe 394 Followers
  • Popular
  • Recent
  • The Registry Editor in Visual Studio.NET 2005

    August 4, 2005 - 0 Comment
  • Application Class and Message Class

    June 8, 2005 - 0 Comment
  • .NET Data Form Wizard

    July 9, 2005 - 0 Comment
  • .NET Exceptions

    July 5, 2005 - 0 Comment
  • Instantiating – Invoking Web Services, Creating Proxy Classes with WSDL

    July 16, 2005 - 0 Comment
  • VB.NET 2005 Free Training

    May 20, 2005 - 0 Comment
  • Microsoft .NET Creating Installation Components

    August 10, 2005 - 0 Comment
  • Setting and Adding Properties to Windows Form

    June 8, 2005 - 0 Comment
  • SQL Server Ad Hoc Queries

    July 9, 2005 - 0 Comment
  • VB.NET Validation Controls

    July 4, 2005 - 0 Comment
  • Microsoft .NET Creating Installation Components

    August 10, 2005 - 0 Comment
  • Shared Assembly

    August 9, 2005 - 0 Comment
  • The File Types Editor

    August 9, 2005 - 0 Comment
  • Tracing VB.NET Windows Application

    August 9, 2005 - 0 Comment
  • VB.NET Windows Application Testing

    August 9, 2005 - 0 Comment
  • The Registry Editor in Visual Studio.NET 2005

    August 4, 2005 - 0 Comment
  • Customizing Setup Project in Visual Studio.NET 2005

    August 4, 2005 - 0 Comment
  • Deploying Windows Applications In Visual Studio.NET 2005

    August 3, 2005 - 0 Comment
  • Debugging Windows Applications In Visual Studio.NET 2005

    August 3, 2005 - 0 Comment
  • Working with Legacy Code and COM Components

    July 30, 2005 - 0 Comment

Exforsys e-Newsletter

ebook
 

Related Articles

  • Microsoft .NET Creating Installation Components
  • Shared Assembly
  • The File Types Editor
  • Tracing VB.NET Windows Application
  • VB.NET Windows Application Testing

Latest Articles

  • Project Management Techniques
  • Product Development Best Practices
  • Importance of Quality Data Management
  • How to Maximize Quality Assurance
  • Utilizing Effective Quality Assurance Strategies
  • Sitemap
  • Privacy Policy
  • DMCA
  • Trademark Information
  • Contact Us
© 2023. All Rights Reserved.IT Training and Consulting
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish.AcceptReject Read More
Privacy & Cookies Policy

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Non-necessary
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
SAVE & ACCEPT