Get value from DomainUpDomain : DomainUpDown « GUI Windows Forms « C# / CSharp Tutorial

Home
C# / CSharp Tutorial
1.Language Basics
2.Data Type
3.Operator
4.Statement
5.String
6.struct
7.Class
8.Operator Overload
9.delegate
10.Attribute
11.Data Structure
12.Assembly
13.Date Time
14.Development
15.File Directory Stream
16.Preprocessing Directives
17.Regular Expression
18.Generic
19.Reflection
20.Thread
21.I18N Internationalization
22.LINQ
23.GUI Windows Forms
24.Windows Presentation Foundation
25.Windows Communication Foundation
26.Workflow
27.2D
28.Design Patterns
29.Windows
30.XML
31.XML LINQ
32.ADO.Net
33.Network
34.Directory Services
35.Security
36.unsafe
C# / C Sharp
C# / C Sharp by API
C# / CSharp Open Source
C# / CSharp Tutorial » GUI Windows Forms » DomainUpDown 
23.13.4.Get value from DomainUpDomain
Get value from DomainUpDomain
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

public class UpDownForm : System.Windows.Forms.Form
{
  private System.ComponentModel.Container components = null;
  private System.Windows.Forms.Label lblCurrSel;
  private System.Windows.Forms.Button btnGetSelections;
  private System.Windows.Forms.Label label2;
  private System.Windows.Forms.Label label1;
  private System.Windows.Forms.NumericUpDown numericUpDown;
  private System.Windows.Forms.DomainUpDown domainUpDown;

  public UpDownForm()
  {
    InitializeComponent();
    domainUpDown.SelectedIndex = 2;
  }

  protected override void Disposebool disposing )
  {
    ifdisposing )
    {
      if (components != null
      {
        components.Dispose();
      }
    }
    base.Disposedisposing );
  }

  private void InitializeComponent()
  {
    this.label1 = new System.Windows.Forms.Label();
    this.label2 = new System.Windows.Forms.Label();
    this.numericUpDown = new System.Windows.Forms.NumericUpDown();
    this.domainUpDown = new System.Windows.Forms.DomainUpDown();
    this.btnGetSelections = new System.Windows.Forms.Button();
    this.lblCurrSel = new System.Windows.Forms.Label();
    ((System.ComponentModel.ISupportInitialize)(this.numericUpDown)).BeginInit();
    this.SuspendLayout();
    // 
    // label1
    // 
    this.label1.Font = new System.Drawing.Font("Verdana"12F);
    this.label1.Location = new System.Drawing.Point(824);
    this.label1.Name = "label1";
    this.label1.Size = new System.Drawing.Size(22432);
    this.label1.TabIndex = 2;
    this.label1.Text = "Domain UpDown Control";
    // 
    // label2
    // 
    this.label2.Font = new System.Drawing.Font("Verdana"12F);
    this.label2.Location = new System.Drawing.Point(880);
    this.label2.Name = "label2";
    this.label2.Size = new System.Drawing.Size(23232);
    this.label2.TabIndex = 3;
    this.label2.Text = "Numeric UpDown Control";
    // 
    // numericUpDown
    // 
    this.numericUpDown.Location = new System.Drawing.Point(26480);
    this.numericUpDown.Maximum = new System.Decimal(new int[] {
                                    5000,
                                    0,
                                    0,
                                    0});
    this.numericUpDown.Name = "numericUpDown";
    this.numericUpDown.Size = new System.Drawing.Size(16820);
    this.numericUpDown.TabIndex = 1;
    this.numericUpDown.ThousandsSeparator = true;
    this.numericUpDown.UpDownAlign = System.Windows.Forms.LeftRightAlignment.Left;
    this.numericUpDown.ValueChanged += new System.EventHandler(this.numericUpDown_ValueChanged);
    // 
    // domainUpDown
    // 
    this.domainUpDown.Items.Add("A");
    this.domainUpDown.Items.Add("B");
    this.domainUpDown.Items.Add("C");
    this.domainUpDown.Items.Add("D");
    this.domainUpDown.Location = new System.Drawing.Point(26424);
    this.domainUpDown.Name = "domainUpDown";
    this.domainUpDown.Size = new System.Drawing.Size(16820);
    this.domainUpDown.Sorted = true;
    this.domainUpDown.TabIndex = 0;
    this.domainUpDown.Text = "domainUpDown1";
    this.domainUpDown.Wrap = true;
    this.domainUpDown.SelectedItemChanged += new System.EventHandler(this.domainUpDown_SelectedItemChanged);
    // 
    // btnGetSelections
    // 
    this.btnGetSelections.Location = new System.Drawing.Point(16136);
    this.btnGetSelections.Name = "btnGetSelections";
    this.btnGetSelections.Size = new System.Drawing.Size(13624);
    this.btnGetSelections.TabIndex = 4;
    this.btnGetSelections.Text = "Get Current Selections";
    this.btnGetSelections.Click += new System.EventHandler(this.btnGetSelections_Click);
    // 
    // lblCurrSel
    // 
    this.lblCurrSel.BackColor = System.Drawing.Color.Linen;
    this.lblCurrSel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
    this.lblCurrSel.Location = new System.Drawing.Point(176120);
    this.lblCurrSel.Name = "lblCurrSel";
    this.lblCurrSel.Size = new System.Drawing.Size(25648);
    this.lblCurrSel.TabIndex = 5;
    // 
    // UpDownForm
    // 
    this.AutoScaleBaseSize = new System.Drawing.Size(513);
    this.ClientSize = new System.Drawing.Size(448181);
    this.Controls.Add(this.lblCurrSel);
    this.Controls.Add(this.btnGetSelections);
    this.Controls.Add(this.label2);
    this.Controls.Add(this.label1);
    this.Controls.Add(this.numericUpDown);
    this.Controls.Add(this.domainUpDown);
    this.Name = "UpDownForm";
    this.Text = "Spin Controls";
    ((System.ComponentModel.ISupportInitialize)(this.numericUpDown)).EndInit();
    this.ResumeLayout(false);

  }

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

  protected void numericUpDown_ValueChanged (object sender, System.EventArgs e)
  {
    this.Text = "You changed the numeric value...";
  }

  protected void domainUpDown_SelectedItemChanged (object sender, System.EventArgs e)
  {
    this.Text = "You changed the string value...";
  }

  protected void btnGetSelections_Click (object sender, System.EventArgs e)
  {
    // Get info from updowns...
    lblCurrSel.Text = string.Format("String: {0}\nNumber: {1}", domainUpDown.Text, numericUpDown.Value);
  }
}
23.13.DomainUpDown
23.13.1.Remove selected item from DomainUpDown
23.13.2.DomainUpDown selected value changed eventDomainUpDown selected value changed event
23.13.3.DomainUpDown: selected item changed eventDomainUpDown: selected item changed event
23.13.4.Get value from DomainUpDomainGet value from DomainUpDomain
23.13.5.TextAlign and UpDownAlignTextAlign and UpDownAlign
23.13.6.Subclass DomainUpDown
23.13.7.ColorUpDown
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.