DomainUpDown: selected item changed event : DomainUpDown « GUI Windows Forms « C# / CSharp Tutorial

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. GUI Windows Forms
23. 2D
24. Design Patterns
25. Windows
26. XML
27. ADO.Net
28. Network
29. Directory Services
30. Security
31. unsafe
Java
Java Tutorial
Java Source Code / Java Documentation
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
C# / C Sharp
ASP.Net
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
PHP
Python
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
C# / CSharp Tutorial » GUI Windows Forms » DomainUpDown 
22. 13. 3. DomainUpDown: selected item changed event
DomainUpDown: selected item changed event
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);
  }
}
22. 13. DomainUpDown
22. 13. 1. Remove selected item from DomainUpDown
22. 13. 2. DomainUpDown selected value changed eventDomainUpDown selected value changed event
22. 13. 3. DomainUpDown: selected item changed eventDomainUpDown: selected item changed event
22. 13. 4. Get value from DomainUpDomainGet value from DomainUpDomain
22. 13. 5. TextAlign and UpDownAlignTextAlign and UpDownAlign
22. 13. 6. Subclass DomainUpDown
w__ww.j___a__v_a_2s_._c__om__ | Contact Us
Copyright 2003 - 08 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.