Convert value from Numeric Dropdown to Int : UpDown « GUI Windows Form « C# / C Sharp

Home
C# / C Sharp
1.2D Graphics
2.Class Interface
3.Collections Data Structure
4.Components
5.Data Types
6.Database ADO.net
7.Design Patterns
8.Development Class
9.Event
10.File Stream
11.Generics
12.GUI Windows Form
13.Language Basics
14.LINQ
15.Network
16.Office
17.Reflection
18.Regular Expressions
19.Security
20.Services Event
21.Thread
22.Web Services
23.Windows
24.Windows Presentation Foundation
25.XML
26.XML LINQ
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source
C# / C Sharp » GUI Windows Form » UpDownScreenshots 
Convert value from Numeric Dropdown to Int
Convert value from Numeric Dropdown to Int

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

public class Form1 : Form
{

   private System.Windows.Forms.NumericUpDown yearUpDown;
   private System.Windows.Forms.Button calculateButton;
   public Form1() {
      InitializeComponent();
   }
   private void calculateButton_Clickobject sender, EventArgs e )
   {
      Console.WriteLine(Convert.ToInt32yearUpDown.Value ));
   
   private void InitializeComponent()
   {
      this.yearUpDown = new System.Windows.Forms.NumericUpDown();
      this.calculateButton = new System.Windows.Forms.Button();
      ((System.ComponentModel.ISupportInitialize)(this.yearUpDown)).BeginInit();
      this.SuspendLayout();

      this.yearUpDown.Location = new System.Drawing.Point(8497);
      this.yearUpDown.Maximum = new decimal(new int[] {
            10,
            0,
            0,
            0});
      this.yearUpDown.Minimum = new decimal(new int[] {
            1,
            0,
            0,
            0});
      this.yearUpDown.Name = "yearUpDown";
      this.yearUpDown.ReadOnly = true;
      this.yearUpDown.Size = new System.Drawing.Size(10020);
      this.yearUpDown.TabIndex = 5;
      this.yearUpDown.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
      this.yearUpDown.Value = new decimal(new int[] {
            1,
            0,
            0,
            0});
      this.calculateButton.Location = new System.Drawing.Point(19616);
      this.calculateButton.Name = "calculateButton";
      this.calculateButton.Size = new System.Drawing.Size(7523);
      this.calculateButton.TabIndex = 8;
      this.calculateButton.Text = "Calculate";
      this.calculateButton.Click += new System.EventHandler(this.calculateButton_Click);
      // 
      // interestCalculatorForm
      // 
      this.AutoScaleDimensions = new System.Drawing.SizeF(6F13F);
      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
      this.ClientSize = new System.Drawing.Size(289288);
      this.Controls.Add(this.calculateButton);
      this.Controls.Add(this.yearUpDown);
      this.Name = "interestCalculatorForm";
      this.Text = "Interest Calculator";
      ((System.ComponentModel.ISupportInitialize)(this.yearUpDown)).EndInit();
      this.ResumeLayout(false);
      this.PerformLayout();

   }

  [STAThread]
  static void Main()
  {
    Application.EnableVisualStyles();
    Application.Run(new Form1());
  }

}



           
       
Related examples in the same category
1.Numeric value based Up Down (Spinner)Numeric value based Up Down (Spinner)
2.String based DomainUpDown (Spinner)String based DomainUpDown (Spinner)
3.UpDown ControlUpDown Control
4.UpDown DerivedUpDown Derived
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.